This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
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
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