试图调用不存在的方法。尝试是从以下位置进行的:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
我正在研究 Spring boot JPA Gridle project
。当前 Swagger
为 运行,在进行 DTO
时发生错误。模块似乎相互冲突。
安装swagger
模块时出现错误,继续swagger,为DTO安装模块。以下模块产生错误:
compile 'org.springframework.boot:spring-boot-starter-hateoas'
并且报错如下
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-03-17 01:26:38.657 ERROR 4688 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
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:
springfox.documentation.spring.web.plugins.DocumentationPluginsManager.createContextBuilder(DocumentationPluginsManager.java:152)
The following method did not exist:
org.springframework.plugin.core.PluginRegistry.getPluginFor(Ljava/lang/Object;Lorg/springframework/plugin/core/Plugin;)Lorg/springframework/plugin/core/Plugin;
The method's class, org.springframework.plugin.core.PluginRegistry, is available from the following locations:
jar:file:/Users/****/.gradle/caches/modules-2/files-2.1/org.springframework.plugin/spring-plugin-core/2.0.0.RELEASE/95fc8c13037630f4aba9c51141f535becec00fe6/spring-plugin-core-2.0.0.RELEASE.jar!/org/springframework/plugin/core/PluginRegistry.class
It was loaded from the following location:
file:/Users/****/.gradle/caches/modules-2/files-2.1/org.springframework.plugin/spring-plugin-core/2.0.0.RELEASE/95fc8c13037630f4aba9c51141f535becec00fe6/spring-plugin-core-2.0.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
我通过搜索尝试的东西也是。
compile group: 'org.springframework.plugin', name: 'spring-plugin-core', version: '2.0.0.RELEASE'
compile group: 'io.springfox', name: 'springfox-data-rest', version: '2.9.2'
他们都没有帮助我。
有没有人遇到和我一样的问题?
还有其他方法可以解决这个问题吗?
问题是 Swagger 和 Hateoas 模块之间存在冲突。多个搜索结果找到解决方案
解决方案是添加一个新模块并为其注册 Bean
。
compile group: 'org.springframework.plugin', name: 'spring-plugin-core', version: '1.2.0.RELEASE'
SwaggerConfig.java
public class SwaggerConfig {
@Bean
public LinkDiscoverers discoverers() {
List<LinkDiscoverer> plugins = new ArrayList<>();
plugins.add(new CollectionJsonLinkDiscoverer());
return new LinkDiscoverers(SimplePluginRegistry.create(plugins));
}
}
对我来说,问题是 JPA 和 Hateoas 依赖项之间的冲突。
我的解决方案是删除 JPA 依赖项,因为我有兴趣改用 Hateoas 模块。
更改了这个:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
</dependency>
为此:
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
</dependency>
我正在研究 Spring boot JPA Gridle project
。当前 Swagger
为 运行,在进行 DTO
时发生错误。模块似乎相互冲突。
安装swagger
模块时出现错误,继续swagger,为DTO安装模块。以下模块产生错误:
compile 'org.springframework.boot:spring-boot-starter-hateoas'
并且报错如下
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-03-17 01:26:38.657 ERROR 4688 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
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:
springfox.documentation.spring.web.plugins.DocumentationPluginsManager.createContextBuilder(DocumentationPluginsManager.java:152)
The following method did not exist:
org.springframework.plugin.core.PluginRegistry.getPluginFor(Ljava/lang/Object;Lorg/springframework/plugin/core/Plugin;)Lorg/springframework/plugin/core/Plugin;
The method's class, org.springframework.plugin.core.PluginRegistry, is available from the following locations:
jar:file:/Users/****/.gradle/caches/modules-2/files-2.1/org.springframework.plugin/spring-plugin-core/2.0.0.RELEASE/95fc8c13037630f4aba9c51141f535becec00fe6/spring-plugin-core-2.0.0.RELEASE.jar!/org/springframework/plugin/core/PluginRegistry.class
It was loaded from the following location:
file:/Users/****/.gradle/caches/modules-2/files-2.1/org.springframework.plugin/spring-plugin-core/2.0.0.RELEASE/95fc8c13037630f4aba9c51141f535becec00fe6/spring-plugin-core-2.0.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
我通过搜索尝试的东西也是。
compile group: 'org.springframework.plugin', name: 'spring-plugin-core', version: '2.0.0.RELEASE'
compile group: 'io.springfox', name: 'springfox-data-rest', version: '2.9.2'
他们都没有帮助我。
有没有人遇到和我一样的问题?
还有其他方法可以解决这个问题吗?
问题是 Swagger 和 Hateoas 模块之间存在冲突。多个搜索结果找到解决方案
解决方案是添加一个新模块并为其注册 Bean
。
compile group: 'org.springframework.plugin', name: 'spring-plugin-core', version: '1.2.0.RELEASE'
SwaggerConfig.java
public class SwaggerConfig {
@Bean
public LinkDiscoverers discoverers() {
List<LinkDiscoverer> plugins = new ArrayList<>();
plugins.add(new CollectionJsonLinkDiscoverer());
return new LinkDiscoverers(SimplePluginRegistry.create(plugins));
}
}
对我来说,问题是 JPA 和 Hateoas 依赖项之间的冲突。
我的解决方案是删除 JPA 依赖项,因为我有兴趣改用 Hateoas 模块。
更改了这个:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
</dependency>
为此:
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
</dependency>