• springboot整合cxf框架启动报错


    异常信息:

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

    Description:

    Parameter 1 of constructor in org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration required a bean of type 'org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath' that could not be found.

    The following candidates were found but could not be injected:
        - Bean method 'dispatcherServletRegistration' in 'DispatcherServletAutoConfiguration.DispatcherServletRegistrationConfiguration' not loaded because DispatcherServlet Registration found non dispatcher servlet dispatcherServlet


    Action:

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


    解决方法:

    由于springboot使用了2.1.2及以上版本,在官方中并未找到整合cxf框架的配置,所以导入cxf-spring-boot-starter-jaxws启动会报错;

    将springboot版本调到2.1.2.RELEASE以下即可正常启动。

    配上pom.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <!--<version>2.1.2.RELEASE</version>-->
            <version>2.0.1.RELEASE</version>
            <relativePath/> <!-- lookup parent from repository -->
        </parent>
        <groupId>com.demo</groupId>
        <artifactId>springboot-cxf-demo</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <name>springboot-cxf-demo</name>
        <description>Demo project for Spring Boot</description>
    
        <properties>
            <java.version>1.8</java.version>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        </properties>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter</artifactId>
            </dependency>
    
            <!-- CXF webservice -->
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-spring-boot-starter-jaxws</artifactId>
                <version>3.2.4</version>
            </dependency>
            <!-- CXF webservice -->
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>
    
    </project>
    
  • 相关阅读:
    spring缓存笔记 半注解版
    乐优商城项目视频及源码
    spring cloud Eureka
    idea+maven搭建ssh,支持事务,无hibernate文件整合
    BUU->CRYPTO 知识点分类
    file-upl0ad
    [RoarCTF 2019]Simple Upload
    BUU UPLOAD COURSE 1
    [GXYCTF2019]Ping Ping Ping
    [SWPU2019]Web1
  • 原文地址:https://www.cnblogs.com/zhangguixing/p/10858122.html
Copyright © 2020-2023  润新知