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
-
原因:@Autowired注解注入時發現有多個實現類,而項目中並無多個實現類的情況,最終發現是由於Hateoas的新功能產生的
-
解決方案:在swagger配置文件中添加以下代碼
@Primary @Bean public LinkDiscoverers discoverers() { List<LinkDiscoverer> plugins = new ArrayList<>(); plugins.add(new CollectionJsonLinkDiscoverer()); return new LinkDiscoverers(SimplePluginRegistry.create(plugins)); }