【问题标题】:Spring Boot 2.2.4 springdoc OpenApi Swagger V3 hateoas issueSpring Boot 2.2.4 springdoc OpenApi Swagger V3 hatoas 问题
【发布时间】:2020-12-18 06:59:42
【问题描述】:

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

***************************
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

请问我怎样才能有效地解决这个问题?谢谢

【问题讨论】:

    标签: java spring-boot spring-hateoas springdoc swagger-3.0


    【解决方案1】:

    通过在 pom 文件中添加此依赖项来解决此问题:

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

    灵感来自this post

    希望这可以帮助某人

    【讨论】:

    • 另外,如果您只使用 spring-hateoas,请确保使用 springdoc-openapi-hateoas 而不是 springdoc-openapi-data-rest。
    猜你喜欢
    • 2021-03-29
    • 2021-06-03
    • 2021-12-21
    • 2022-12-06
    • 1970-01-01
    • 2020-06-25
    • 2020-04-02
    • 2021-06-01
    • 2021-10-08
    相关资源
    最近更新 更多