How can I access the ApplicationContext from within a JAX-WS web service?

前端 未结 5 2102
温柔的废话
温柔的废话 2021-02-15 08:29

Similar to How can I access the ServletContext from within a JAX-WS web service?, is there a way to access applicationContext, easier than this?

import javax.ann         


        
5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-15 08:59

    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.beans.factory.annotation.Qualifier;
    import org.springframework.web.context.support.SpringBeanAutowiringSupport;
    
    
    @WebService( 
        endpointInterface = "Bla", 
        targetNamespace = "http://bla/v001", 
        wsdlLocation = "WEB-INF/wsdl/bla.wsdl",    
        serviceName = "BlaService",
        portName = "BlaPort")
    public class BlaWs extends SpringBeanAutowiringSupport implements BlaPort {
    
      @Autowired
      @Qualifier("dao") 
      private Dao dao;
      ...
    }
    

提交回复
热议问题