spring boot 2.0 整合cxf遇到的坑

CXF环境搭建网上的帖子大致相同,参考:
https://blog.csdn.net/maple_fix/article/details/79884320

遇到的问题,启动项目报以下错误:

***************************
APPLICATION FAILED TO START
***************************

Description:

Method servletEndpointRegistrar in org.springframework.boot.actuate.autoconfigure.endpoint.web.ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration required a bean of type 'org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPathProvider' that could not be found.
	- Bean method 'mainDispatcherServletPathProvider' not loaded because Default DispatcherServlet found non dispatcher servlet bean dispatcherServlet


Action:

Consider revisiting the conditions above or defining a bean of type 'org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPathProvider' in your configuration.

经查阅资料找到 解决办法,参考博客https://blog.csdn.net/qq_37394874/article/details/86523678:
将spring boot 版本换成 2.0.1RELEASE

	
    
        org.springframework.boot
        spring-boot-starter-parent
        
        2.0.1.RELEASE
         
    

cxf jar包使用以下两个版本都可以:

		
		
		-->
		
        
            org.apache.cxf
            cxf-spring-boot-starter-jaxws
            3.2.4
        
		

至此,问题解决了:
访问如下地址也能正确看到wsdl
http://localhost:8081/dc/webservice/user?wsdl
spring boot 2.0 整合cxf遇到的坑_第1张图片

2019-10-21:

FS项目集成webservice时启动再次遇到问题,百度到其他博客的解决办法:
application.properties中添加如下配置

cxf.path=/webservice

SpringBoot版本和cxf版本:



    org.springframework.boot
    spring-boot-starter-parent
    2.0.3.RELEASE
     




    org.apache.cxf
    cxf-spring-boot-starter-jaxws
    3.2.4

spring boot 2.0 整合cxf遇到的坑_第2张图片

使用postman测试webservice接口:

spring boot 2.0 整合cxf遇到的坑_第3张图片
spring boot 2.0 整合cxf遇到的坑_第4张图片
body中的参数值:



    
        
            ProviderDetailsQuery
            PrincipalPerson.administrativeGenderCodePrincipalPerson.birthDateHealthCareProvider.id李医生PrincipalPerson.name]]>
        
    

body中的参数格式:



    
        
            ProviderDetailsQuery
            
        
    

你可能感兴趣的:(cxf,webservice,java)