zoukankan      html  css  js  c++  java
  • 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>
    
  • 相关阅读:
    网络面试题-1
    CentOS7下配置Squid代理
    docker使用harbor搭建私有仓库
    docker 基础命令
    docker要隔离的的6种namespace
    python 列表中的数字转为字符串
    python 排列组合
    filter函数
    Pytest配置文件声明自定义用例标识
    pytest参数化
  • 原文地址:https://www.cnblogs.com/zhangguixing/p/10858122.html
Copyright © 2011-2022 走看看