Hi,

there is no need to define a spring bean for your struts actions. At least when 
you use a struts.xml. I have not tried what happens when you use annotations. 
As far as I now, all struts actions will be created as prototypes by spring. 
If you define them in the applicationsContext.xml, they will be created as 
singeltons, which can cause issues, if you don't expect this behavior.

Regards,

Pascal

On Wednesday 29 February 2012 07:52:03 Puneet Babbar 2 wrote:
> Thanks for replying to my post, I have already checked that link but still
> no clue as to how to make spring plugin work with the convention plugin.
> 
> Suppose I have an Action  -
> @Action("/login-page")
> public class LoginPage extends ActionSupport {
> 
>       public LoginPage(){
> 
>       }
>       public String execute(){
>               return SUCCESS;
>       }
> }
> 
> 
> I have added spring plugin to my application and have added the following
> bean definition in my applicationContext.xml
> 
> <bean id="login-page" class="com.test.login.LoginPage" />
> 
> I debugged the application -
> Now when I load my application and send a request for the login-page action,
> I see that the action is being created 2 times 1)When applicationContext is
> read when the application comes up.
> 2)When the request is sent for this action, struts creates another instance
> and this instance is used to service the request.
> 
> So basically, I am not able to get the action object I have created using
> spring to be used by struts to process the requests when using convention
> plugin
> 
> The Struts spring integration works fine when I used the normal struts.xml
> approach(not using convention plugin)
> 
> Now can you help me out?
> 
> 
> Regards
> 
> Puneet
> -----Original Message-----
> From: Steven Yang [mailto:kenshin...@gmail.com]
> Sent: Wednesday, February 29, 2012 12:16 PM
> To: Struts Users Mailing List
> Subject: Re: Struts, spring integration while using struts annotations
> 
> check this  http://struts.apache.org/2.0.8/docs/spring-plugin.html
> 
> you can use spring along with the annotation in the convention-plugin such
> as @Action, etc
> 
> On Tue, Feb 28, 2012 at 6:01 PM, Puneet Babbar 2 
<pbabb...@sapient.com>wrote:
> > Hi,
> > 
> > I am using struts annotations with my applications, I need to add
> > spring's support to my application.
> > I am not able to find any content on how to use the beans(the struts
> > action classes) initialized using spring as my action  when I am using
> > struts annotations?
> > 
> > Regards
> > 
> > Puneet
> 
> ---------------------------------------------------------------------
> 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

Reply via email to