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

SpringBoot  在pom中引入swagger以后,项目直接跑不起来了报如下错误


Description:

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

    org.springframework.data.rest.core.support.UnwrappingRepositoryInvokerFactory.<init>(UnwrappingRepositoryInvokerFactory.java:57)

The following method did not exist:

    org.springframework.plugin.core.PluginRegistry.of(Ljava/util/List;)Lorg/springframework/plugin/core/PluginRegistry;

The method's class, org.springframework.plugin.core.PluginRegistry, is available from the following locations:

    jar:file:/C:/Users/User/.m2/repository/org/springframework/plugin/spring-plugin-core/1.2.0.RELEASE/spring-plugin-core-1.2.0.RELEASE.jar!/org/springframework/plugin/core/PluginRegistry.class

The class hierarchy was loaded from the following locations:

    org.springframework.plugin.core.PluginRegistry: file:/C:/Users/User/.m2/repository/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

Process finished with exit code 1

面向百度编程就是这点一好,百度爸爸告诉我是因为swagger中有一个jar和我们默认引入的jar冲突了,导致无法正确找到jar

下面是我的引入的



<!--swagger图形化接口-->

    <groupId>io.springfox

    <artifactId>springfox-swagger2

    <version>2.9.2

    <groupId>io.springfox

    <artifactId>springfox-swagger-ui

    <version>2.9.2

</dependency>



而正确的引入方式是:



<dependency>

            <groupId>io.springfox</groupId>

            <artifactId>springfox-swagger2</artifactId>

            <version>2.9.2</version>

            <exclusions>

                <exclusion>

                    <groupId>org.springframework.plugin</groupId>

                    <artifactId>spring-plugin-core</artifactId>

                </exclusion>

                <exclusion>

                    <groupId>org.springframework.plugin</groupId>

                    <artifactId>spring-plugin-metadata</artifactId>

                </exclusion>

            </exclusions>

        </dependency>

    <dependency>

        <groupId>io.springfox</groupId>

        <artifactId>springfox-swagger-ui</artifactId>

        <version>2.9.2</version>

OK 完美解决


©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容