Bryan S said the following on 8/9/2007 10:37 AM:
I was sidetracked at work shortly after starting this thread. I'm just getting back to it today. I've dug deeper and this still has me stumped. I know that my set method is getting called and variables.instance.activedirectorydao does have a value before it leaves the setter but then when it gets to the getter it doesn't have it any more I don't know what is causing this. Any help would be appreciated.
Where are you calling the get method? Inside your init() method perhaps? ColdSpring calls init() but does NOT calls the required setters until later in the process. If you are call getActiveDirectoryDAO() in your init() method, it won't be there because it hasn't been set yet.

Resolution:
1. Use constructor-arg injection (not preferred since it can lead to unresolvable circular dependences later down the line)
- or -
2. Move service setup code from your init() method into the a new method (I usually call mine setup) and add init-method="setup" to your CS bean xml file. ColdSpring will init() the service, do stuff, wire in any dependencies and lastly - before returned the fully composed object - call your "init-method" (in this example called "setup"). Yea, I know that init-method is strange attribute name, but that's because Java has it's own constructors and in CF use init() as the defacto standard for a constructor (since CF doesn't have built-in constructors). So there is a bit of differences going on here as we try to keep inline with Spring.dtd and Spring's implementation.

HTH,
Peter


Reply via email to