SimpleJaxWsServiceExporter を使用して POJO エンドポイントを開発する際に SpringBeanAutowiringSupport が機能しない
Issue
@WebServiceアノテーションが付いたクラスを JBoss EAP 5.x にデプロイし、依存性の注入をエンドポイントクラスに設定しました。- 注入が適切に実行されることを確認するために
SpringBeanAutoWiringSupportを設定しましたが、注入は機能していないようです。 - エンドポイントをパブリッシュするために Spring の
SimpleJaxWsServiceExporterを使用しました。 - クライアントコードを使用して基になるサービスを呼び出すと、
@Autowiredアノテーションが注入されたオブジェクトでNullPointerExceptionが返されます。 -
サンプルアプリケーションコードは以下のようになります。
-
サービスインターフェイス:
package ws;
import org.springframework.stereotype.Service;
@Service("greetingService")
public interface GreetingService {
public String sayHello();
}
- サービス Bean
package ws;
import org.springframework.stereotype.Component;
@Component
public class Greetings {
public String getGreeting() {
return "Welcome to MedCloudDataStore!!!";
}
}
- サービスエンドポイント
package ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
@WebService(serviceName = "GreetingService")
public class GreetingServiceEndpoint extends SpringBeanAutowiringSupport implements GreetingService {
@Autowired
private Greetings greetings;
@WebMethod
public String sayHello() {
return greetings.getGreeting();
}
}
Environment
- JBoss Enterprise Application Platform (EAP)
- 5.x
- 6.0.0
- 6.0.1
- JBossWS-CXF
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.