Can Spring provide dependency-injection in this example? If so, how?
In the code snippet below, the blank final declaration of the attribute strangeState is satisfied in the enum's constructor by invoking new Straneness( int q).
If we want to eliminate the new Straneness( int q) by using Spring to assign an instance of Strangeness, we would have a problem. First, the blank final would flag an error if strangeState is not defined during the constructor execution. Second, if we simply assign null to strangeState, or remove the final, how can we be sure that Spring's subsequent replacement of the strangeState value with new Straneness( int q) will not corrupt the bytecode? How would Spring handle this situation properly?
I believe this objective is beyond the capabilities of Spring. Let me know if you agree, or not. Thanks in advance for your constructive insights.
Juan Rolando Prieur-Reza, M.S., LSSBB, SCEA, SCBCD, SCWCD, SCJP/1.6, IBM OOAD, SCSA