当前位置: 首页 > 工具软件 > xcash-core > 使用案例 >

Swagger3和SpringBoot搭配,spring-plugin-core报错

荆利
2023-12-01

错误详情如下

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

Description:

An attempt was made to call the method org.springframework.plugin.core.PluginRegistry.getPluginFor(Ljava/lang/Object;)Ljava/util/Optional; but it does not exist. Its class, org.springframework.plugin.core.PluginRegistry, is available from the following locations:

    jar:file:/C:/programs/maven/localHouse/org/springframework/plugin/spring-plugin-core/1.2.0.RELEASE/spring-plugin-core-1.2.0.RELEASE.jar!/org/springframework/plugin/core/PluginRegistry.class

It was loaded from the following location:

    file:/C:/programs/maven/localHouse/org/springframework/plugin/spring-plugin-core/1.2.0.RELEASE/spring-plugin-core-1.2.0.RELEASE.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.plugin.core.PluginRegistry

按照错误提示,怀疑是包冲突,于是执行mvn dependency:tree >tree.log进行maven依赖查看,结果spring-plugin-core 1.2.0-RELEASE只有springfox在使用(即Swagger3),所以并不存在冲突的问题

解决方案:强制将依赖版本升级到2.0,问题解决

        <dependency>
            <groupId>org.springframework.plugin</groupId>
            <artifactId>spring-plugin-core</artifactId>
            <version>2.0.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.plugin</groupId>
            <artifactId>spring-plugin-metadata</artifactId>
            <version>2.0.0.RELEASE</version>
        </dependency>
 类似资料: