I think that it is normal to have both, one for Spring MVC, and another for Struts, both being WebApplicationContext type. The ContextLoaderPlugIn will create a new WebApplicationContext whose parent is Spring's WebApplicationContext. So calling Struts' WebApplicationContext.getParent() should be the same has calling ActionSupport.getWebApplicationContext().
You are providing the same application context file to both the loaders (plugin and contextloaderlistener). And thats why its being loaded twice.
A better and more correct approach would be to split the applicationContext.xml into 2 files say, applicationContext-web.xml and applicationContext-main.xml. All the delegating proxy definitions can go into the applicationContext-struts.xml file and all other business logic, facade beans etc can go into the applicationContext-main.xml. Provide the applicationContext-struts.xml to the plugin and the other xml to the ContextLoaderListener. And yes beans defined in applicationContext-struts.xml can ref to the beans defined in applicationContext-main.xml.
Sab<br /> <br />Perfection does not come from belief or faith. Talk does not count for anything. Parrots can do that. Perfection comes through selfless work.<br />Swami Vivekananda
Can you please not hijack other ranchers' thread ? You've already asked in your own thread somewhere. Please do not duplicate posts.
kri shan
Ranch Hand
Joined: Apr 08, 2004
Posts: 1303
posted
0
Can i mention applicationContext-struts.xml file thru <plug-in > only in struts-config.xml (or) in both the places(struts-config.xml & web.xml(thru ContextListener)) ?
HI all, i think this thread is very much close to my problem i declard the plug in my struts config file like this <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn"> <set-property property= "contextConfigLocation" value="/WEB-INF/applicationContext-hibernate.xml"/> </plug-in>
and my action class extends Action Support. but when i call my action class i get Action not found error. Any help where i am going wrong
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Spring + Struts [1 web app / 2 ApplicationContext]