|
Hello, I ran into an issue with the auto wiring. It appears when
you have a default-autowire set autowire=”no” in a bean does not
cause auto wiring to be turned off on the bean. I looked in the listserv logs
to see if anyone has had this problem, but I couldn’t find anything so I
decided to post. Here is some sample code. This is how my beans tag is set up. <beans default-autowire="byName"> This is an example of the bean that I want not to autowire. <bean id="bean" class="path.to.bean" singleton="false"
autowire="no"> <property
name="beanService"> <ref
bean="beanService" /> </property> </bean> I got expected functionality after changing line 186 of code
in the defaultXMLBeanFactory. <!--- look for an autowire attribute for this bean def
---> <cfif StructKeyExists(beanAttributes,'autowire') and listFind('byName,byType',beanAttributes['autowire'])> <cfset
autowire = beanAttributes['autowire'] /> </cfif> Adding a no to the listfind will make the bean not autowire <!--- look for an autowire attribute for this bean def
---> <cfif StructKeyExists(beanAttributes,'autowire') and listFind('byName,byType,no',beanAttributes['autowire'])> <cfset
autowire = beanAttributes['autowire'] /> </cfif> It seems that autowire is only getting explicitly set if it
is byName or byType. Like I said I’m not sure if this has been covered
before, but it makes sense to me that “no” should turn off auto
wiring. Thanks for your time, Joe Ferraro |
