2009/1/26 dusty <dustin_pea...@yahoo.com>: > When using the struts2-spring-plugin, without bean declaration for your > actions, what is the default scope for the created Action beans? Prototype, > I hope, but I can't really find where that is set or happens. I know the > default for Spring beans when not otherwise specified is Singleton, so I am > curious how the plugin gets the prototype scope in this instance. > > The setup is: > > * ContextLoaderListener in web.xml > * struts2-spring-plugin declared in maven > * actions configured as such in struts.xml > <action name="show" class="com.full.package.Action" method="show"> > .... > </action> > * No Spring bean configuration for actions in XML or annotations. > > What is the scope of the created actions? How do you test/prove that?
In such way, when Spring is not able to create an action (no bean defintion), standard Struts2 ObjectFactory is used instead, which will create action for each request. > There are other variations that I wonder about: > * Bean definition for action in XML but with no "scope='prototype'" > * struts2-spring-plugin in path > > Which one wins? This seems like it should be a singleton since your XML > config should override any "auto" behavior of the plugin, but are we sure? Singleton > * @Component annotation on your action (with spring configured to find bean > annotations in that package) > * No @Scope annotation on the action bean > * struts2-spring-plugin in path > Probably singleton, right? IMHO, yes. Regards -- Lukasz http://www.lenart.org.pl/ --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org