2

私が作成したJAX-WS Web サービスを使用しようとしています。私はいつもnullPointerException春の自動配線された注釈付きの Bean を取得します。ただし、serverSide over Web 内ではすべて正常に動作しますが、Bean にはJAX-WS webserviceを介してアクセスします。

を拡張してみましたSpringBeanAutowiringSupportが、まだ運がありません。これどうやってするの。

よろしく、 Rohit

4

1 に答える 1

0

SpringBeanAutowiringSupport を拡張した経験はありませんでしたが、このアプローチをうまく使用しました。

  1. 次のように webService クラスに注釈を付けます。

    @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>
    

このアプローチを使用して、Spring で JAX を使用することに成功しました

于 2012-04-11T19:15:25.380 に答える