首页  >  文章  >  正确的应用程序类路径,使其包含 org.springframework.beans.factory.config.ConfigurableListableBeanFactory 的单个兼容版本

正确的应用程序类路径,使其包含 org.springframework.beans.factory.config.ConfigurableListableBeanFactory 的单个兼容版本

王林
王林转载
2024-02-05 22:24:031019浏览
问题内容

我收到以下错误 应用程序无法启动

描述:

尝试调用不存在的方法。尝试从以下位置进行:

org.springframework.boot.actuate.autoconfigure.startup.startupendpointautoconfiguration$applicationstartupcondition.getmatchoutcome(startupendpointautoconfiguration.java:63)

以下方法不存在:

org.springframework.beans.factory.config.configurablelistablebeanfactory.getapplicationstartup()lorg/springframework/core/metrics/applicationstartup;

该方法的类 org.springframework.beans.factory.config.configurablelistablebeanfactory 可从以下位置获取: jar:文件:/users/doc/.m2/repository/org/springframework/spring-beans/5.2.5.release/spring-beans-5.2.5.release.jar!/org/springframework/beans/factory/config /configurablelistablebeanfactory.class

它是从以下位置加载的:

file:/users/doc/.m2/repository/org/springframework/spring-beans/5.2.5.release/spring-beans-5.2.5.release.jar

行动:

更正应用程序的类路径,使其包含单个兼容版本的 org.springframework.beans.factory.config.configurablelistablebeanfactory

pom

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.2.6.RELEASE</version>

</parent>



<properties>
    <java.version>1.8</java.version>
 

   
    <!-- Spring Dependencies -->
    <spring-retry.version>1.3.1</spring-retry.version>
    <spring-cloud-netflix-core.version>1.1.7.RELEASE</spring-cloud-netflix-core.version>
    <spring-cloud-vault-config.version>3.1.1</spring-cloud-vault-config.version>
    <spring-vault-core.version>2.3.2</spring-vault-core.version>
 



    <!-- Swagger Dependencies -->
    <springfox-swagger2.version>2.4.0</springfox-swagger2.version>

   
</properties>
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.retry</groupId>
            <artifactId>spring-retry</artifactId>
            <version>${spring-retry.version}</version>
        </dependency>
        
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-netflix-core</artifactId>
            <version>${spring-cloud-netflix-core.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-vault-config</artifactId>
            <version>${spring-cloud-vault-config.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.vault</groupId>
            <artifactId>spring-vault-core</artifactId>
            <version>${spring-vault-core.version}</version>
        </dependency>
        
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Hoxton.SR6</version>
        </dependency>
       
        
       
        <!-- Swagger Dependencies-->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${springfox-swagger2.version}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>${springfox-swagger2.version}</version>
        </dependency>
        <!-- Testing dependencies -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-staticdocs</artifactId>
            <version>${springfox-swagger2.version}</version>
        </dependency>
    </dependencies>
</dependencyManagement>
<dependencies>
  
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-vault-config</artifactId>
        <version>${spring-cloud-vault-config.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.vault</groupId>
        <artifactId>spring-vault-core</artifactId>
        <version>${spring-vault-core.version}</version>
    </dependency>
    
   
    <!-- Spring dependencies -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-actuator-autoconfigure</artifactId>
        <version>2.4.0</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.25</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jdbc</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.retry</groupId>
        <artifactId>spring-retry</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-openfeign</artifactId>
        <version>2.0.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
        <version>2.1.0.RELEASE</version>
    </dependency>

正确答案


您正试图超越 spring boot 和 spring cloud 依赖管理,并包含大量不兼容的版本。只需在 dependencymanagement 部分添加 spring-cloud-dependency 即可简化依赖关系管理。删除所有其他的,因为它们已经由 spring boot 或您拥有的 spring cloud 依赖项管理。

接下来从 dependencie 部分的依赖项中删除版本,并删除 spring-boot-actuator-autoconfiguration 依赖项,该依赖项包含在 spring-boot-starter 中。

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.2.13.RELEASE</version>
</parent>

<properties>
    <java.version>1.8</java.version>

    <!-- Swagger Dependencies -->
    <springfox-swagger2.version>2.4.0</springfox-swagger2.version>

   
</properties>
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Hoxton.SR12</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <!-- Swagger Dependencies-->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${springfox-swagger2.version}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>${springfox-swagger2.version}</version>
        </dependency>
        <!-- Testing dependencies -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-staticdocs</artifactId>
            <version>${springfox-swagger2.version}</version>
        </dependency>
    </dependencies>
</dependencyManagement>
<dependencies>
  
    <!-- Spring dependencies -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jdbc</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.retry</groupId>
        <artifactId>spring-retry</artifactId>
    </dependency>

    <!-- Spring Cloud Starter -->
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-openfeign</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-vault-config</artifactId>
    </dependency>
   
</dependencies>

现在,依赖项由兼容版本中的 spring boot 和 spring cloud 正确管理。

以上是正确的应用程序类路径,使其包含 org.springframework.beans.factory.config.ConfigurableListableBeanFactory 的单个兼容版本的详细内容。更多信息请关注PHP中文网其他相关文章!

声明:
本文转载于:stackoverflow.com。如有侵权,请联系admin@php.cn删除