引用依赖
<!--Webservice-->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.1.6</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>3.1.6</version>
</dependency>
服务端发布服务
创建 CxfConfig类
package com.example.springmybatisshiro.common.config;
import com.example.springmybatisshiro.modules.sys.service.IUserService;
import com.example.springmybatisshiro.modules.sys.service.impl.UserServiceImpl;
import com.example.springmybatisshiro.modules.webservice.IdemoService;
import com.example.springmybatisshiro.modules.webservice.impl.DemoServiceImpl;
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 javax.xml.ws.Endpoint;
@Configuration
public class CxfConfig {
@Bean
public ServletRegistrationBean servletRegistrationBean(){
return new ServletRegistrationBean(new CXFServlet(),"/demo/*");
}