Hi Micael, I think putting a breakpoint on OtherAction.setFooService and probing the full stack trace when the execution hits it for second time would help to reveal what and who's the villain of second injection :)
Regards. >-----Original Message----- >From: Micael Carreira <mcarre...@itclinical.com> >Sent: Thursday, December 20, 2018 10:55 PM >To: user@struts.apache.org >Subject: Context parameters not being ignored? > >Hello, > >I'm using Struts2 with Spring. I have the following action: > > SomeAction > |- FooService > >But in my bean definition I don't have the FooService dependency because >SomeAction doesn't use it: > > <bean id="someAction" class="SomeAction" scope="prototype" /> > >(Putting it this way doesn't make much sense, the real configuration is more >complex than this, but this is the simplest example on how the problem can be >reproduced) > >Then my struts.xml redirects to a jsp result: > > <action name="SomeAction*" method="{1}" class="someAction"> > <result>/jsp/some.jsp</result> > </action> > > >And some.jsp calls other action: > > <s:action name="OtherAction" var="other" executeResult="false" >ignoreContextParams="true"></s:action> > >But OtherAction actually needs FooService as a dependency, and its bean >definition reflects that: > > <bean id="otherAction" class="OtherAction" scope="prototype"> > <property name="fooService" ref="fooService" /> > </bean> > >I noticed that when OtherAction gets instantiated through jsp parsing, it >first gets >set with the correct fooService dependency. > >However, after that, fooService then gets set with null. So OtherAction won't >be >able to correctly run. > >I already assessed that the second injection is the value that is present in >SomeAction. > >But I don't want this value injected. It shouldn't be injected if I'm running >OtherAction with ignoreContextParams="true", right? > >I have been all day around this problem, so any help would be much appreciated. > >Cheers, >Micael > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >For additional commands, e-mail: user-h...@struts.apache.org