问题描述
我试图在我的webservice中启用Spring自动装配支持,遵循以下几行
public class MyService extends SpringBeanAutowiringSupport implements SomeInterface {
private Dao dao;
@Autowired
public void setDao(Dao dao) {
this.dao = dao;
}
使用MyService类注释
@WebService(endpointInterface = "SomeInterfacePath")
但是,当我尝试运行它时,我得到了一个
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)
错误,我无法找到解决方案。 我正在使用Spring 3.0 jar和apache-cxf。 Spring自动装配在我??的项目的其他地方工作,但似乎在这里不能很好地发挥作用。 关于发生了什么的任何想法? 我在appConfig中定义了一个jaxws端点
<jaxws:endpoint
id="myendpoint"
implementor="MyService"
address="/helloworld
/>
1楼
直到最近,Apache CXF还将Spring 2.5.5作为maven依赖。 但是,CXF 2.3版和更新版使用Spring 3。
:
<spring.version>2.5.5</spring.version>
:
<spring.version>3.0.4.RELEASE</spring.version>
两者都包含一个<dependencymanagement>
部分,它将Spring与指定的版本联系起来。