You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by nani2ratna <na...@gmail.com> on 2010/01/26 18:19:36 UTC

bean tag scope attribute in spring appcontext.xml

Hi Guys,

I came to know that there is a scope attribute that we need to consider if
we manage all our actions through spring.
default it is singleton. Means it will create only one instance.
If we change scope = "prototype", it will create as many instances.
scope = "request", it will create for every request, 
scope="session" means it will create one instance for every user sesson.

I think we need to change it to scope="prototype".
Do we need to do this only for action classes or we need to do for dao's and
service classes which we call them from action classes.
Can anybody please explain....


Thanks in advance
RS
-- 
View this message in context: http://old.nabble.com/bean-tag-scope-attribute-in-spring-appcontext.xml-tp27326363p27326363.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: bean tag scope attribute in spring appcontext.xml

Posted by Rafał Krupiński <r....@gmail.com>.
On 26.01.2010 18:19, nani2ratna wrote:
>
> Hi Guys,
>
> I came to know that there is a scope attribute that we need to consider if
> we manage all our actions through spring.
> default it is singleton. Means it will create only one instance.
> If we change scope = "prototype", it will create as many instances.
> scope = "request", it will create for every request,
> scope="session" means it will create one instance for every user sesson.
>
> I think we need to change it to scope="prototype".
> Do we need to do this only for action classes or we need to do for dao's and
> service classes which we call them from action classes.
> Can anybody please explain....

Usually DAOs and other service layer beans should be defined with singleton scope, only action beans should be 
with prototype.

I'm not sure how struts with action beans declared with request scope would behave in non-trivial situations.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org