Error enabling SpringBeanAutowiringSupport within a JAX-WS web service
I am trying to enable Spring autowiring support in my webservice, following the lines of
public class MyService extends SpringBeanAutowiringSupport imp开发者_如何学Pythonlements SomeInterface {
private Dao dao;
@Autowired
public void setDao(Dao dao) {
this.dao = dao;
}
With the MyService class annotated with
@WebService(endpointInterface = "SomeInterfacePath")
However, when I try and run this, I get a
java.lang.NoSuchMethodError: org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext()Lorg/springframework/web/context/WebApplicationContext;
at org.springframework.web.context.support.SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(SpringBeanAutowiringSupport.java:81)
at org.springframework.web.context.support.SpringBeanAutowiringSupport.<init>(SpringBeanAutowiringSupport.java:68)
error, which I haven't been able to find a resolution to. I'm using Spring 3.0 jars and apache-cxf. Spring autowiring works elsewhere in my project but doesn't seem to play nicely here. Any ideas as to what is going on? I have a a jaxws endpoint defined in my appConfig as
<jaxws:endpoint
id="myendpoint"
implementor="MyService"
address="/helloworld
/>
Until recently, Apache CXF pulled Spring 2.5.5 as a maven dependency. However, CXF Version 2.3 and newer use Spring 3.
Apache CXF parent pom 2.2.1:
<spring.version>2.5.5</spring.version>
Apache CXF parent pom 2.3:
<spring.version>3.0.4.RELEASE</spring.version>
Both include a <dependencymanagement>
section that ties Spring to the specified version.
精彩评论