I actually spent some time going through the code, and I can see the error

Looking at: DefaultXMLBeanFactory,

Line 479 - we loop through all the functions, and call the init() and
the setBeanFactory() functions on a constructBean call, regardless of
whether or not the Bean has come from a factory or not.

Seems like that block of code should be inside the above <cfif> block
(~477)  - unless of course you want to also do the check for
setBeanFactory() on factory created beans (which you may wish to). In
which case, there should be a check for if the Bean has a Factory,
before init is called.

So line 482 should read:
<cfif md.functions[functionIndex].name eq "init" AND
beanDef.getFactoryBean() eq "">
(which is how it now reads in my local file)

Side note - why not have a 'isFactoryBean()' method on your
BeanDefintion? - it would save you a whole lot of checking for
'getBeanFactory() eq ""'... or Len(getBeanFactory()) etc...

Hope that helps,

Mark

On 4/27/06, Mark Mandel <[EMAIL PROTECTED]> wrote:
> Hey -
>
> The latest version through me for a spin.
>
> It looks like if you have a
> <bean id="beanFOne" factory-bean="factory" factory-method="getBeanOne"/>
>
> when CS goes to get beanFOne, it calls init on the bean.
>
> This tends to make things fall over when the init() takes a param that
> is required, or you don't want this to happen.
>
> I can only assume this is a bug?
>
> I've attached another test bed (in a zip this time!), so hopefully you
> should be able to see what I'm talking about.
>
> Cheers,
>
> Mark
>
> --
> E: [EMAIL PROTECTED]
> W: www.compoundtheory.com
> ICQ: 3094740
>
>
>


--
E: [EMAIL PROTECTED]
W: www.compoundtheory.com
ICQ: 3094740

Reply via email to