首页 > 解决方案 > 将 Spring Boot 从 2.2.2.Release 升级到 2.4.2 Rlease 的问题

问题描述

我们有一个与 SpringBoot 2.2.2.RELEASE 配合使用的现有应用程序。现在我们尝试将其升级到 SpringBoot 2.4.2 版本并且应用程序没有启动并抛出以下错误。在类路径中,我只能看到一个 spring-webmvc-5.3.2.jar 文件。

以下是 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.4.2</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>


    <groupId>com.test</groupId>
    <artifactId>test-api</artifactId>
    <version>1.0</version>

    <name>Microservice</name>
    <description>Microservice</description>
    <packaging>jar</packaging>

    <properties>
        <java.version>13</java.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-sleuth</artifactId>
                <version>3.0.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
        </dependency>

        <!-- Needed to produce both an Executable and Importable JAR. Two jars 
            will now be produced -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client -->
        <dependency>
            <groupId>org.mariadb.jdbc</groupId>
            <artifactId>mariadb-java-client</artifactId>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.kafka</groupId>
            <artifactId>spring-kafka</artifactId>
        </dependency>

        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-netty</artifactId>
            <version>1.25.0</version>
        </dependency>

        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-protobuf</artifactId>
            <version>1.25.0</version>
        </dependency>

        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-stub</artifactId>
            <version>1.25.0</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
        </dependency>
        
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-jpamodelgen</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.5.2</version>
        </dependency>
        
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-data-rest</artifactId>
            <version>1.5.2</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.datadoghq/dd-trace-api -->
        <dependency>
            <groupId>com.datadoghq</groupId>
            <artifactId>dd-trace-api</artifactId>
            <version>0.66.0</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-sleuth</artifactId>
        </dependency>

        <dependency>
            <groupId>org.redisson</groupId>
            <artifactId>redisson</artifactId>
            <version>3.13.2</version>
        </dependency>

        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.15</version>
        </dependency>
    </dependencies>

    <build>
        <finalName>test-api</finalName>
        <plugins>

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>

                <!-- Needed to produce both an Executable and Importable JAR. Two jars 
                    will now be produced -->
                <executions>
                    <execution>
                        <id>repackage</id>
                        <configuration>
                            <classifier>exec</classifier>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


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

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration.lambda$addResourceHandlers$0(WebMvcAutoConfiguration.java:411)

The following method did not exist:

    'org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.addResourceLocations(org.springframework.core.io.Resource[])'

The method's class, org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration, is available from the following locations:

    jar:file:/C:/Users/test/.m2/repository/org/springframework/spring-webmvc/5.3.2/spring-webmvc-5.3.2.jar!/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistration.class

The class hierarchy was loaded from the following locations:

    org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration: file:/C:/Users/test/.m2/repository/org/springframework/spring-webmvc/5.3.2/spring-webmvc-5.3.2.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration

依赖树:

C:\Users\test-api>mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< com.test:test-api >------------------
[INFO] Microservice 1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:3.1.2:tree (default-cli) @ test-api ---
[WARNING] The POM for org.apache.maven:maven-artifact:jar:3.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] com.fmr.AP135913:test-api:jar:1.0
[INFO] +- org.springframework.boot:spring-boot-starter-validation:jar:2.4.2:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.4.2:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.4.2:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] |  |  |  \- org.apache.logging.log4j:log4j-to-slf4j:jar:2.13.3:compile
[INFO] |  |  \- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  +- org.glassfish:jakarta.el:jar:3.0.3:compile
[INFO] |  \- org.hibernate.validator:hibernate-validator:jar:6.1.7.Final:compile
[INFO] |     +- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
[INFO] |     \- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.4.2:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:2.4.2:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.11.3:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.11.3:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.4.2:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.41:compile
[INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.41:compile
[INFO] |  +- org.springframework:spring-web:jar:5.3.2:compile
[INFO] |  |  \- org.springframework:spring-beans:jar:5.3.2:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:5.3.2:compile
[INFO] |     +- org.springframework:spring-aop:jar:5.3.2:compile
[INFO] |     \- org.springframework:spring-expression:jar:5.3.2:compile
[INFO] +- org.springframework.boot:spring-boot-starter-log4j2:jar:2.4.2:compile
[INFO] |  +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.13.3:compile
[INFO] |  |  \- org.apache.logging.log4j:log4j-api:jar:2.13.3:compile
[INFO] |  +- org.apache.logging.log4j:log4j-core:jar:2.13.3:compile
[INFO] |  +- org.apache.logging.log4j:log4j-jul:jar:2.13.3:compile
[INFO] |  \- org.slf4j:jul-to-slf4j:jar:1.7.30:compile
[INFO] +- org.springframework.boot:spring-boot-configuration-processor:jar:2.4.2:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.4.2:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:2.4.2:compile
[INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.9.6:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.4.2:compile
[INFO] |  |  +- com.zaxxer:HikariCP:jar:3.4.5:compile
[INFO] |  |  \- org.springframework:spring-jdbc:jar:5.3.2:compile
[INFO] |  +- jakarta.transaction:jakarta.transaction-api:jar:1.3.3:compile
[INFO] |  +- jakarta.persistence:jakarta.persistence-api:jar:2.2.3:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:5.4.27.Final:compile
[INFO] |  |  +- org.javassist:javassist:jar:3.27.0-GA:compile
[INFO] |  |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |  +- org.jboss:jandex:jar:2.1.3.Final:compile
[INFO] |  |  +- org.dom4j:dom4j:jar:2.1.3:compile
[INFO] |  |  \- org.hibernate.common:hibernate-commons-annotations:jar:5.1.2.Final:compile
[INFO] |  +- org.springframework.data:spring-data-jpa:jar:2.4.2:compile
[INFO] |  |  +- org.springframework.data:spring-data-commons:jar:2.4.2:compile
[INFO] |  |  \- org.springframework:spring-orm:jar:5.3.2:compile
[INFO] |  \- org.springframework:spring-aspects:jar:5.3.2:compile
[INFO] +- org.mariadb.jdbc:mariadb-java-client:jar:2.7.1:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.11.3:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.11.3:compile
[INFO] |  \- com.fasterxml.jackson.core:jackson-core:jar:2.11.3:compile
[INFO] +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.11.3:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.4.2:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:2.4.2:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.4.2:test
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.4.0:compile
[INFO] |  |  \- net.minidev:json-smart:jar:2.3:compile
[INFO] |  |     \- net.minidev:accessors-smart:jar:1.2:compile
[INFO] |  |        \- org.ow2.asm:asm:jar:5.0.4:compile
[INFO] |  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:compile
[INFO] |  |  \- jakarta.activation:jakarta.activation-api:jar:1.2.2:compile
[INFO] |  +- org.assertj:assertj-core:jar:3.18.1:test
[INFO] |  +- org.hamcrest:hamcrest:jar:2.2:test
[INFO] |  +- org.junit.jupiter:junit-jupiter:jar:5.7.0:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-api:jar:5.7.0:test
[INFO] |  |  |  +- org.apiguardian:apiguardian-api:jar:1.1.0:test
[INFO] |  |  |  +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] |  |  |  \- org.junit.platform:junit-platform-commons:jar:1.7.0:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-params:jar:5.7.0:test
[INFO] |  |  \- org.junit.jupiter:junit-jupiter-engine:jar:5.7.0:test
[INFO] |  |     \- org.junit.platform:junit-platform-engine:jar:1.7.0:test
[INFO] |  +- org.mockito:mockito-core:jar:3.6.28:test
[INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.10.19:test
[INFO] |  |  \- org.objenesis:objenesis:jar:3.0.1:test
[INFO] |  +- org.mockito:mockito-junit-jupiter:jar:3.6.28:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] |  +- org.springframework:spring-core:jar:5.3.2:compile
[INFO] |  |  \- org.springframework:spring-jcl:jar:5.3.2:compile
[INFO] |  +- org.springframework:spring-test:jar:5.3.2:test
[INFO] |  \- org.xmlunit:xmlunit-core:jar:2.7.0:test
[INFO] +- org.springframework.kafka:spring-kafka:jar:2.6.5:compile
[INFO] |  +- org.springframework:spring-context:jar:5.3.2:compile
[INFO] |  +- org.springframework:spring-messaging:jar:5.3.2:compile
[INFO] |  +- org.springframework:spring-tx:jar:5.3.2:compile
[INFO] |  +- org.springframework.retry:spring-retry:jar:1.3.1:compile
[INFO] |  \- org.apache.kafka:kafka-clients:jar:2.6.0:compile
[INFO] |     +- com.github.luben:zstd-jni:jar:1.4.4-7:compile
[INFO] |     +- org.lz4:lz4-java:jar:1.7.1:compile
[INFO] |     \- org.xerial.snappy:snappy-java:jar:1.1.7.3:compile
[INFO] +- io.grpc:grpc-netty:jar:1.25.0:compile
[INFO] |  +- io.grpc:grpc-core:jar:1.25.0:compile (version selected from constraint [1.25.0,1.25.0])
[INFO] |  |  +- com.google.code.gson:gson:jar:2.8.6:compile
[INFO] |  |  +- com.google.android:annotations:jar:4.1.1.4:compile
[INFO] |  |  +- io.perfmark:perfmark-api:jar:0.19.0:compile
[INFO] |  |  +- io.opencensus:opencensus-api:jar:0.21.0:compile
[INFO] |  |  \- io.opencensus:opencensus-contrib-grpc-metrics:jar:0.21.0:compile
[INFO] |  +- io.netty:netty-codec-http2:jar:4.1.55.Final:compile
[INFO] |  |  \- io.netty:netty-codec-http:jar:4.1.55.Final:compile
[INFO] |  \- io.netty:netty-handler-proxy:jar:4.1.55.Final:compile
[INFO] |     \- io.netty:netty-codec-socks:jar:4.1.55.Final:compile
[INFO] +- io.grpc:grpc-protobuf:jar:1.25.0:compile
[INFO] |  +- io.grpc:grpc-api:jar:1.25.0:compile
[INFO] |  |  +- io.grpc:grpc-context:jar:1.25.0:compile
[INFO] |  |  +- com.google.errorprone:error_prone_annotations:jar:2.3.3:compile
[INFO] |  |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] |  |  \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.17:compile
[INFO] |  +- com.google.protobuf:protobuf-java:jar:3.10.0:compile
[INFO] |  +- com.google.guava:guava:jar:28.1-android:compile
[INFO] |  |  +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO] |  |  +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] |  |  +- org.checkerframework:checker-compat-qual:jar:2.5.5:compile
[INFO] |  |  \- com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO] |  +- com.google.api.grpc:proto-google-common-protos:jar:1.12.0:compile
[INFO] |  \- io.grpc:grpc-protobuf-lite:jar:1.25.0:compile
[INFO] +- io.grpc:grpc-stub:jar:1.25.0:compile
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:2.4.2:compile
[INFO] |  +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.4.2:compile
[INFO] |  |  \- org.springframework.boot:spring-boot-actuator:jar:2.4.2:compile
[INFO] |  \- io.micrometer:micrometer-core:jar:1.6.2:compile
[INFO] |     +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile
[INFO] |     \- org.latencyutils:LatencyUtils:jar:2.0.3:runtime
[INFO] +- org.springframework.boot:spring-boot-devtools:jar:2.4.2:compile
[INFO] |  +- org.springframework.boot:spring-boot:jar:2.4.2:compile
[INFO] |  \- org.springframework.boot:spring-boot-autoconfigure:jar:2.4.2:compile
[INFO] +- org.hibernate:hibernate-jpamodelgen:jar:5.4.27.Final:compile
[INFO] |  +- org.jboss.logging:jboss-logging:jar:3.4.1.Final:compile
[INFO] |  +- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO] |  |  \- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] |  \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.3:compile
[INFO] |     +- org.glassfish.jaxb:txw2:jar:2.3.3:compile
[INFO] |     +- com.sun.istack:istack-commons-runtime:jar:3.0.11:compile
[INFO] |     \- com.sun.activation:jakarta.activation:jar:1.2.2:runtime
[INFO] +- org.springdoc:springdoc-openapi-ui:jar:1.5.2:compile
[INFO] |  +- org.springdoc:springdoc-openapi-webmvc-core:jar:1.5.2:compile
[INFO] |  |  \- org.springdoc:springdoc-openapi-common:jar:1.5.2:compile
[INFO] |  |     +- io.swagger.core.v3:swagger-models:jar:2.1.6:compile
[INFO] |  |     +- io.swagger.core.v3:swagger-annotations:jar:2.1.6:compile
[INFO] |  |     +- io.swagger.core.v3:swagger-integration:jar:2.1.6:compile
[INFO] |  |     |  \- io.swagger.core.v3:swagger-core:jar:2.1.6:compile
[INFO] |  |     +- io.github.classgraph:classgraph:jar:4.8.69:compile
[INFO] |  |     \- org.apache.commons:commons-lang3:jar:3.11:compile
[INFO] |  +- org.webjars:swagger-ui:jar:3.38.0:compile
[INFO] |  \- org.webjars:webjars-locator-core:jar:0.46:compile
[INFO] +- org.springdoc:springdoc-openapi-data-rest:jar:1.5.2:compile
[INFO] |  +- org.springdoc:springdoc-openapi-hateoas:jar:1.5.2:compile
[INFO] |  |  \- org.springframework.hateoas:spring-hateoas:jar:1.2.3:compile
[INFO] |  \- org.springframework.data:spring-data-rest-core:jar:3.4.2:compile
[INFO] |     +- org.springframework.plugin:spring-plugin-core:jar:2.0.0.RELEASE:compile
[INFO] |     \- org.atteo:evo-inflector:jar:1.2.2:compile
[INFO] +- com.datadoghq:dd-trace-api:jar:0.66.0:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.30:compile
[INFO] +- org.springframework.cloud:spring-cloud-starter-sleuth:jar:3.0.0:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-starter:jar:3.0.0:compile
[INFO] |  |  +- org.springframework.cloud:spring-cloud-context:jar:3.0.0:compile
[INFO] |  |  |  \- org.springframework.security:spring-security-crypto:jar:5.4.2:compile
[INFO] |  |  +- org.springframework.cloud:spring-cloud-commons:jar:3.0.0:compile
[INFO] |  |  \- org.springframework.security:spring-security-rsa:jar:1.0.9.RELEASE:compile
[INFO] |  |     \- org.bouncycastle:bcpkix-jdk15on:jar:1.64:compile
[INFO] |  |        \- org.bouncycastle:bcprov-jdk15on:jar:1.64:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-sleuth-autoconfigure:jar:3.0.0:compile
[INFO] |  |  +- org.springframework.cloud:spring-cloud-sleuth-instrumentation:jar:3.0.0:compile
[INFO] |  |  |  \- org.springframework.cloud:spring-cloud-sleuth-api:jar:3.0.0:compile
[INFO] |  |  \- org.aspectj:aspectjrt:jar:1.9.6:compile
[INFO] |  \- org.springframework.cloud:spring-cloud-sleuth-brave:jar:3.0.0:compile
[INFO] |     +- io.zipkin.brave:brave:jar:5.13.2:compile
[INFO] |     +- io.zipkin.brave:brave-context-slf4j:jar:5.13.2:compile
[INFO] |     +- io.zipkin.brave:brave-instrumentation-messaging:jar:5.13.2:compile
[INFO] |     +- io.zipkin.brave:brave-instrumentation-rpc:jar:5.13.2:compile
[INFO] |     +- io.zipkin.brave:brave-instrumentation-spring-rabbit:jar:5.13.2:compile
[INFO] |     +- io.zipkin.brave:brave-instrumentation-kafka-clients:jar:5.13.2:compile
[INFO] |     +- io.zipkin.brave:brave-instrumentation-kafka-streams:jar:5.13.2:compile
[INFO] |     +- io.zipkin.brave:brave-instrumentation-httpclient:jar:5.13.2:compile
[INFO] |     |  \- io.zipkin.brave:brave-instrumentation-http:jar:5.13.2:compile
[INFO] |     +- io.zipkin.brave:brave-instrumentation-httpasyncclient:jar:5.13.2:compile
[INFO] |     +- io.zipkin.brave:brave-instrumentation-jms:jar:5.13.2:compile
[INFO] |     +- io.zipkin.brave:brave-instrumentation-mongodb:jar:5.13.2:compile
[INFO] |     +- io.zipkin.aws:brave-propagation-aws:jar:0.21.3:compile
[INFO] |     \- io.zipkin.reporter2:zipkin-reporter-metrics-micrometer:jar:2.16.1:compile
[INFO] |        \- io.zipkin.reporter2:zipkin-reporter:jar:2.16.1:compile
[INFO] |           \- io.zipkin.zipkin2:zipkin:jar:2.23.0:compile
[INFO] +- org.redisson:redisson:jar:3.13.2:compile
[INFO] |  +- io.netty:netty-common:jar:4.1.55.Final:compile
[INFO] |  +- io.netty:netty-codec:jar:4.1.55.Final:compile
[INFO] |  +- io.netty:netty-buffer:jar:4.1.55.Final:compile
[INFO] |  +- io.netty:netty-transport:jar:4.1.55.Final:compile
[INFO] |  |  \- io.netty:netty-resolver:jar:4.1.55.Final:compile
[INFO] |  +- io.netty:netty-resolver-dns:jar:4.1.55.Final:compile
[INFO] |  |  \- io.netty:netty-codec-dns:jar:4.1.55.Final:compile
[INFO] |  +- io.netty:netty-handler:jar:4.1.55.Final:compile
[INFO] |  +- javax.cache:cache-api:jar:1.1.1:compile
[INFO] |  +- io.projectreactor:reactor-core:jar:3.4.1:compile
[INFO] |  |  \- org.reactivestreams:reactive-streams:jar:1.0.3:compile
[INFO] |  +- io.reactivex.rxjava2:rxjava:jar:2.2.20:compile
[INFO] |  +- org.jboss.marshalling:jboss-marshalling-river:jar:2.0.9.Final:compile
[INFO] |  |  \- org.jboss.marshalling:jboss-marshalling:jar:2.0.9.Final:compile
[INFO] |  +- org.yaml:snakeyaml:jar:1.27:compile
[INFO] |  +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.11.3:compile
[INFO] |  +- net.bytebuddy:byte-buddy:jar:1.10.19:compile
[INFO] |  \- org.jodd:jodd-bean:jar:5.0.13:compile
[INFO] |     \- org.jodd:jodd-core:jar:5.0.13:compile
[INFO] \- commons-codec:commons-codec:jar:1.15:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.008 s
[INFO] Finished at: 2021-01-25T11:32:30-05:00
[INFO] ------------------------------------------------------------------------

C:\Users\test-api>

标签: spring-boot

解决方案


如此处所述https://github.com/spring-projects/spring-boot/issues/25049#event-4265028906

Importing spring-cloud-sleuth as a BOM for dependency management is very suspect.

更换这个后

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-sleuth</artifactId>
                <version>3.0.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

有了这个,它工作正常。

<dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-dependencies</artifactId>
        <version>${spring-cloud.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

推荐阅读