thats strange,
because I currently have a service that is setup with the same sort
of init defined empty space, setter injection..and it works
perfectly...is this behavior across the board? or only with
setBeanFactory?
Derek P.
[EMAIL PROTECTED]
On Aug 24, 2007, at 6:44 AM, Brian Kotek wrote:
That was exactly the problem to start with. ColdSpring runs the
setters for dependency injections BEFORE it runs the init() method.
It does this to resolve circular dependencies. So your bean factory
WAS being set, it was just getting deleted again when your init
method ran.
On 8/23/07, Jason Fill <[EMAIL PROTECTED]> wrote:
Sean - that makes sense. Ok so thinking along the lines of the init
() method messing everything up I changed my init() from:
<cffunction name="init" returntype="sys.efs.Service ">
<cfset Variables.Factory = "" />
<cfreturn this />
</cffunction>
To
<cffunction name="init" returntype="sys.efs.Service">
<cfreturn this />
</cffunction>
And it works now. So basically what appears to have been happening
is it was calling the setBeanFactory() method, then calling init,
which was overriding the Variables.Factory variable. Seems to work
great now. Anyone see issues with this?
On 8/23/07, Sean Corfield < [EMAIL PROTECTED]> wrote:
On 8/23/07, Jason Fill <[EMAIL PROTECTED]> wrote:
> I have been having the same issue. Below is the code that I have
setup and
> also I have autowiring turned on. I have looked in the
> DefaultXmlBeanFactory and everything I have setup looks like it
*should*
> function correctly. It looks like it should add the factory by
default in
> the constructBean() method around line 549.
That happens around line 745 in the version of ColdSpring I have but
it only attempts bean factory injection if you have no init() method!
If you have an init() method, setBeanFactory() is never called.
Another possible approach is to declare your bean as
factory-post-processor="true" and add a method called
postProcessBeanFactory() which takes a bean factory argument.
I'll update my local ColdSpring and see what's changed but I'll bet
the init() method issue is what's tripping both you and Derek up
here...
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood