Spring Boot 2.2.4 springdoc OpenApi Swagger V3 hateoas 问题

huangapple go评论116阅读模式
英文:

Spring Boot 2.2.4 springdoc OpenApi Swagger V3 hateoas issue

问题

在将 springdoc-openapi-data-rest 库集成到项目中,以将 Pageable(spring-data-commons)对象映射到Swagger UI中的正确URL参数后,我遇到了这个问题:

***************************
应用启动失败
***************************

描述:

方法 org.springframework.hateoas.config.HateoasConfiguration 中的参数 0 需要一个单一的 bean,但找到了 3 个:
	- relProviderPluginRegistry:由类路径资源 [org/springframework/hateoas/config/HateoasConfiguration.class] 中的方法 'relProviderPluginRegistry' 定义
	- linkDiscovererRegistry:在 null 中定义
	- entityLinksPluginRegistry:由类路径资源 [org/springframework/hateoas/config/WebMvcEntityLinksConfiguration.class] 中的方法 'entityLinksPluginRegistry' 定义

操作:

考虑将其中一个 bean 标记为 @Primary,更新使用方以接受多个 bean,或者使用 @Qualifier 标识应该被使用的 bean

进程以退出代码 0 完成

请问我应该如何有效地解决这个问题?谢谢

英文:

After integrating the springdoc-openapi-data-rest library to map Pageable(spring-date-commons) object to correct URL-Parameter in Swagger UI I encountered this problem:

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

Description:

Parameter 0 of method linkDiscoverers in org.springframework.hateoas.config.HateoasConfiguration required a single bean, but 3 were found:
	- relProviderPluginRegistry: defined by method 'relProviderPluginRegistry' in class path resource [org/springframework/hateoas/config/HateoasConfiguration.class]
	- linkDiscovererRegistry: defined in null
	- entityLinksPluginRegistry: defined by method 'entityLinksPluginRegistry' in class path resource [org/springframework/hateoas/config/WebMvcEntityLinksConfiguration.class]


Action:

Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed


Process finished with exit code 0

please how could I effectively solve this problem ? thanks

答案1

得分: 3

为了解决这个问题,您可以在pom文件中添加以下依赖项:

<dependency>
    <groupId>org.springframework.hateoas</groupId>
    <artifactId>spring-hateoas</artifactId>
    <version>1.1.1.RELEASE</version>
</dependency>

受到这篇帖子的启发。

希望这能帮助到他人。

英文:

To solve this issue by adding this dependency in pom file:

&lt;dependency&gt;
	&lt;groupId&gt;org.springframework.hateoas&lt;/groupId&gt;
	&lt;artifactId&gt;spring-hateoas&lt;/artifactId&gt;
	&lt;version&gt;1.1.1.RELEASE&lt;/version&gt;
&lt;/dependency&gt;

Inspired by this post

Hope that this could help someone

huangapple
  • 本文由 发表于 2020年8月30日 00:06:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/63649093.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定