Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在JAX-WS服务中未检测到SpringBean_Java_Spring Mvc_Jax Ws_Cxf - Fatal编程技术网

Java 在JAX-WS服务中未检测到SpringBean

Java 在JAX-WS服务中未检测到SpringBean,java,spring-mvc,jax-ws,cxf,Java,Spring Mvc,Jax Ws,Cxf,我正在尝试使用我编写的JAX-WSCXFWebService。对于spring自动连接的带注释的bean,我总是得到nullPointerException。然而,除了通过JAX-WSCXFWebService访问bean之外,服务器端的一切都可以通过web正常工作 我尝试过扩展SpringBeanAutowiringSupport,但仍然没有成功。我怎样才能做到这一点 问候,, Aqif您是否在web.xml中添加了Spring的ContextLoaderListener <cont

我正在尝试使用我编写的JAX-WSCXFWebService。对于spring自动连接的带注释的bean,我总是得到nullPointerException。然而,除了通过JAX-WSCXFWebService访问bean之外,服务器端的一切都可以通过web正常工作

我尝试过扩展SpringBeanAutowiringSupport,但仍然没有成功。我怎样才能做到这一点

问候,,
Aqif

您是否在
web.xml
中添加了Spring的
ContextLoaderListener

  <context-param> 
    <param-name>contextConfigLocation</param-name>
    <param-value>WEB-INF/beans.xml</param-value>
  </context-param>

  <listener> 
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>

上下文配置位置
WEB-INF/beans.xml
org.springframework.web.context.ContextLoaderListener
我想出了我的答案:)

我不得不将它添加到我的
applicationContext.xml

<!--Person Service Settings -->
<jaxws:endpoint id="personService"  implementor="#person" address="/personService" />
<bean id="person" class="com.service.PersonServiceImpl" />
<bean id="PersonDAO" class="com.dao.PersonDAOImpl"/>
<!--Person Service Settings -->


我认为@WebService注释类是由CXF而不是Spring初始化的,并且不是Spring容器的一部分。如何将这些链接在一起。请帮忙!我添加了contextLoaderlistner,但它没有上下文参数,它们是什么,beans.xml中应该有什么?