springboot CXF配置类

import javax.xml.ws.Endpoint;

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.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.DispatcherServlet;
@Configuration
public class CxfConfig {
    
              @Bean
              public ServletRegistrationBean dispatcherRegistration(
                  DispatcherServlet dispatcherServlet) {
               return new ServletRegistrationBean(
                      dispatcherServlet, "/*");
              }

              @Bean
              public ServletRegistrationBean servletRegistrationBean() {
                return new ServletRegistrationBean(
                    new CXFServlet(), "/services/*");
              }
              @Bean(name = Bus.DEFAULT_BUS_ID)
             public SpringBus springBus() {
                 return new SpringBus();
              }
              @Bean
             public WebServiceInterface app1() {
                 return new app1impl();
             }
             
             @Bean
              public Endpoint endpoint() {
                 EndpointImpl endpoint = new EndpointImpl(springBus(), app1());
                 endpoint.publish("/app1");
                  return endpoint;
              }
}

你可能感兴趣的:(springboot CXF配置类)