package org.jeecg.modules.wms.config; import org.apache.cxf.Bus; import org.apache.cxf.bus.spring.SpringBus; import org.apache.cxf.jaxws.EndpointImpl; import org.apache.cxf.transport.servlet.CXFServlet; import org.jeecg.modules.wms.service.MESWebServiceSoap; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import javax.xml.ws.Endpoint; @Configuration public class WebServiceServerConfig { @Autowired private MESWebServiceSoap webServiceSoap; @Bean(name = Bus.DEFAULT_BUS_ID) public Bus springBus() { return new SpringBus(); } @Bean(name = "cxfServlet") // 注入servlet bean name不能dispatcherServlet ,否则会覆盖dispatcherServlet public ServletRegistrationBean cxfServlet() { return new ServletRegistrationBean<>(new CXFServlet(), "/webservice/*"); } @Bean public Endpoint endpoint() { // 参数二,是SEI实现类对象 Endpoint endpoint = new EndpointImpl(this.springBus(), webServiceSoap); // 发布服务 endpoint.publish("/MESWebService"); return endpoint; } }