Jan 17th, 2006, 06:50 PM
Yet another way to integrate Struts into Spring
I read about the two different ways to integrate Struts: use ContextLoaderPlugin, and either using ActionSupport, or the DelegationActionProxy. I was surprised to see the jpetstore sample from the Spring source suggests a very intersting "integration" which is
WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicati onContext(servletContext);
this.petStore = (PetStoreFacade) wac.getBean("petStore");
Question 1 Is the ContextLoaderPlugin really necessary? Or is it just prefered such that we can separate Struts beans from the root context?
<set-property property="contextConfigLocation" value="/WEB-INF/beans.xml"/>
Questio 2 This proposed way of integratio works for getting any Datasource or Service beans. It seems to be a good way to migrate old Struts application to Spring. The advantage is that it gets the root web application context without having to use the ActionSupport class. The disadvantage is that we can't use any of Spring's AOP,which is available when Struts Actions are wired using DelegationActioProxy. Given that the way shown in the jpetstore sample is simple, what is the benefit of choosing the ActionSupport integration?