Spring 不会自动连接带有 JAX-WS Web 服务端点的 bean



我正在尝试使用由我编写的 JAX-WS Web 服务。我总是nullPointerException春天自动接线的注释豆子。但是,在 serverSide over Web 中一切正常,但通过 JAX-WS Web 服务访问 bean

我尝试延长SpringBeanAutowiringSupport,但仍然没有运气。我该怎么做。

问候,罗希特

我没有扩展SpringBeanAutoWiringSupport的经验,但成功地使用了这种方法:

  1. 这种方式注释 Web 服务类:

    @Component("yourWebService")  
    @WebService(endpointInterface ="your.package.YourServicePort")
    
  2. 为 webService 创建新的 spring-context xml 并定义 JAX-WS 端点:

    <jaxws:endpoint
        id="yourServiceEndpoint"
        implementor="#yourWebService"
        address="${yourWebService.wsdl.url}"> //load url from properties file
    </jaxws:endpoint>       
    
  3. 我想你知道春天如何使用道具,但为了以防万一,你会解释。您还应该创建yourWebService.properties文件并在 spring 上下文中定义它以使用此构造${yourWebService.wsdl.url}

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
       <property name="locations">
          <list>
              <value>yourWebService.properties</value>
          </list>
       </property>
    

使用这种方法,我已经成功地将JAX与Spring一起使用。

最新更新