首页 > 解决方案 > 对于另一个使用 open api 和 swagger v3

问题描述

当我使用 swagger v3(不再是 swagger v2)并打开 api 时收到此错误

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

我的应用程序使用了错误的 spring-plugin-core,我只是从 1.2.0.RELEASE 更改为 2.0.0.RELEASE 并解决了。请记住,如果您尝试创建LinkDiscoverersbean,则应将其删除,它将返回有关LinkDiscoverersbean的另一个错误

<dependency>
           <groupId>org.springframework.plugin</groupId>
           <artifactId>spring-plugin-core</artifactId>
          <version>2.0.0.RELEASE</version>
</dependency>

标签: javaspringswagger

解决方案


推荐阅读