【发布时间】:2011-07-26 01:05:40
【问题描述】:
我正在尝试在我的 web 服务中启用 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
/>
【问题讨论】:
-
闻起来像春季版本的冲突。确保您只有 Spring 3.0 JAR。检查 CXF JAR 以确保其中没有隐藏 Spring 的副本。
-
谢谢,原来使用的是旧版本的 Spring 框架 jar,因此发生了冲突。
-
最好将其添加为答案并接受它,以供该网站的其他用户查看。
标签: java web-services spring jax-ws