You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Aum Strut <au...@gmail.com> on 2012/10/01 20:06:11 UTC
Bean scope type in Struts2 plugin
Hi All,
i am having a small doubt regarding bean creation in struts2,while going
through some of the plugin i saw following code
inside the Interceeptor
@Inject
public void setMyManager(MyManager myManager) {
this.MyManager = myManager;
}
and here is the entry in struts-plugin.xml file
<bean type="abc.MyManager" class="abc.DefaultManager" />
My doubt is how the DefaultManager will be instantiated,since the
intercepor will get called each time there is a call to the action for
which this particular interceptor has been configures, so will S2 going to
create a new instance of "DefaultManager" or will it be a singlton which
will get created at the time of application startup?
i have tried to search docs but not able to fine anything related to this
Thanks in advance
Re: Bean scope type in Struts2 plugin
Posted by Lukasz Lenart <lu...@apache.org>.
2012/10/1 Aum Strut <au...@gmail.com>:
> Hi All,
>
> i am having a small doubt regarding bean creation in struts2,while going
> through some of the plugin i saw following code
>
> inside the Interceeptor
>
> @Inject
> public void setMyManager(MyManager myManager) {
> this.MyManager = myManager;
> }
>
> and here is the entry in struts-plugin.xml file
>
> <bean type="abc.MyManager" class="abc.DefaultManager" />
>
> My doubt is how the DefaultManager will be instantiated,since the
> intercepor will get called each time there is a call to the action for
> which this particular interceptor has been configures, so will S2 going to
> create a new instance of "DefaultManager" or will it be a singlton which
> will get created at the time of application startup?
>
> i have tried to search docs but not able to fine anything related to this
https://svn.apache.org/repos/asf/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/inject/Scope.java
And by default the scope is DEFAULT - as above when you didn't specify
the scope.
Regards
--
Ćukasz
+ 48 606 323 122 http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org