it’s a mixture of things:
* Struts.xml should be setup to know about spring:
<constant name="struts.objectFactory"
value="org.apache.struts2.spring.StrutsSpringObjectFactory" />
<constant name="struts.objectFactory.spring.autoWire.alwaysRespect"
value="true" />
<constant name="struts.objectFactory.spring.autoWire" value="name" />
* register the appropriate application listeners
* add the @Scope variables to controllers
--
_________________________________________________________
Adam Brin
Director of Technology, Digital Antiquity
480.965.1278
> On Sep 29, 2017, at 9:03 AM, Burton Rhodes <[email protected]> wrote:
>
> How do you put a Spring object into the Struts application scope Map on
> startup of a web application? I have 2 listeners that I thought would be
> the usual suspects, but have not had success yet.
>
> I have a ServletContextListener class but on the
> contextInitialized(ServletContextEvent event) method, my spring bean has
> not been created yet.
>
> Secondly, I have a Spring "ApplicationListener", but in the
> onApplicationEvent(ApplicationEvent event) method,
> "ServletActionContext.getContext()" is null. How is this traditionally
> accomplished?
>
> Thanks!
> Burton