I looked at the code and it cannot be set to none. I fixed it in struts and xwork trunks, so in the future you will be able to set "struts.objectFactory.spring.autoWire" to "no". The spring value is AutowireCapableBeanFactory.AUTOWIRE_NO, so I followed the pattern and used "no" instead of "none".
musachy On Fri, Jan 16, 2009 at 11:41 AM, Timothy Orme <to...@genome.med.harvard.edu> wrote: > So scratch that, I figured out that Struts is set to autowire by default > with the spring plugin. > > In my struts.xml I have: > > <constant name="struts.objectFactory" > value="org.apache.struts2.spring.StrutsSpringObjectFactory" /> > <constant name="struts.objectFactory.spring.autoWire" value="type" /> > > And am now autowiring by type instead of name. However, does anyone know how > to turn off autowiring altogether? > I've seen a feature request for this, but it hasn't been filled yet. Has > anyone devised a workaround? > > Thanks, > Tim Orme > > Timothy Orme wrote: >> >> This seems really strange to me, but I don't know the inner workings of >> struts enough to know if it's expected behavior. >> >> I'm using Struts 2.1.2 and spring 2.5.3 >> >> I have a 2 service beans that have the same name, but depending on the >> action, one might be used instead of the other. >> >> >> <bean id="hibernateUserService" >> class="hibernate.service.impl.LoginUserServiceImpl"> >> </bean> >> >> <bean id="sqlUserService" class="sql.service.impl.LoginUserServiceImpl"> >> </bean> >> >> <bean id="submitQuoteAction" class="action.quotes.SubmitQuoteAction"> >> <property name="userService" ref="hibernateUserService" /> >> </bean> >> >> <bean id="registerUserAction" class="action.users.RegisterUserAction"> >> <property name="userService" ref="sqlUserService"/> >> </bean> >> >> So I have 2 beans, each serving a similar purpose, so named the same, but >> used in different actions. >> >> What happens is, at the webapp startup, I see the beans get injected into >> the actions fine. The types are correct, and the property is set. The server >> starts without any issues. However, whats strange is that when I try and go >> to either action I get a null pointer for the userService objects in both >> actions. >> >> I did notice though, that if I name one of the service beans to just >> "userService" instead of say, "hibernateUserService" then one of the actions >> will work correctly, while the other will fail saying that it cant cast >> sql.service.impl.LoginUserServiceImpl to >> hibernate.service.impl.LoginUserServiceImpl. >> >> It seems then that Struts is wiring the properties by bean name and >> overriding the beans that I have specified in my applicationContext. Does >> anyone know what would cause this or how to work around it? >> >> Thanks, >> Tim Orme >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org