package com.whyc.webService;
|
|
import org.apache.cxf.Bus;
|
import org.apache.cxf.jaxws.EndpointImpl;
|
import org.apache.cxf.transport.servlet.CXFServlet;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
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 WsConfig {
|
|
@Autowired
|
private IMS_Service service;
|
|
@Autowired
|
@Qualifier(Bus.DEFAULT_BUS_ID)
|
public Bus bus;
|
|
@Bean
|
public ServletRegistrationBean<CXFServlet> servletServletRegistrationBean() {
|
return new ServletRegistrationBean<>(new CXFServlet(), "/ws/*");
|
}
|
|
//发布服务
|
@Bean
|
public Endpoint IMS_Service(){
|
EndpointImpl endpoint = new EndpointImpl(bus,service);
|
endpoint.publish("/IMS_Service");
|
return endpoint;
|
}
|
|
}
|