whyclxw
2025-02-13 d62fa80f3d12a56ae60eeef45f07cea6477c2507
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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;
    }
 
}