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沖突了梗醇,導(dǎo)致無法正確找到j(luò)ar
下面是我的引入的
<!--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 完美解決