JAX WS webservice does not take spring bean from applicationcontext, hence throws null pointer exception

后端 未结 6 1823
终归单人心
终归单人心 2021-01-18 07:55

Hi I have got the webservice up and running , i have used jax ws. I have used Spring to be able to use beans with Autowired and stuff that spring gives like property value i

6条回答
  •  感动是毒
    2021-01-18 08:58

    No Need to use ApplicationContext as well, if you do the following things

    1. Annotate your service class with @Service
    2. Service class should extends "SpringBeanAutowiringSupport".

    Please have a look at the following snippet.

    @org.springframework.stereotype.Service
    @javax.jws.WebService (endpointInterface="a.b.c.MyPort", 
                targetNamespace="http://a.b.co.in/Retail/MyService/V1", 
                serviceName="MyService", 
                portName="MyServicePort", 
                wsdlLocation="wsdl/MyService.wsdl")
    public class MyServiceBindingImpl extends org.springframework.web.context.support.SpringBeanAutowiringSupport{
    

提交回复
热议问题