I have all of these settings in place, but your comments spurred the idea to have a "BaseAction" class where I autowire my object (MyApplicationSettings.java) and then extend all of my Actions from this class.
Just for my info though... My original line of thinking was to be able to access the object with the following: Map application = (Map) ActionContext.getContext().get("application"); application.get("myApplicationSettings"); ---or--- <s:property value="#application.myApplicatoinSettings" /> I just couldn't figure out a way to put the object in the struts application scope within a listener during startup. Does that make sense? On Fri, Sep 29, 2017 at 11:50 AM, Adam Brin <ab...@digitalantiquity.org> wrote: > 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 <burtonrho...@gmail.com> > 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 > >