struts2 spring plugin - it complains about getBean() of WebApplicationContext not being found

983 Views Asked by At

I am using Struts 2.2.3.1 and using Struts2-spring plugin 2.2.3.1 with it. The dependency injections are working fine, but my use of ApplicationContext's getBean method is breaking :

WebApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(context);
AdminService service = ac.getBean(AdminService.class);

This is how I used to inject dependencies into my Struts project using Spring 3.0.6 (AdminService is a bean declared in applicationContext.xml. But now, with the addition of this plugin, it gives the following error :

cannot find symbol symbol : method getBean(java.lang.Class) location: interface org.springframework.web.context.WebApplicationContext

If I remove this plugin, then it works. What's the reason ?

0

There are 0 best solutions below