当前位置: 代码迷 >> 综合 >> HateoasConfiguration required a single bean, but 17 were found
  详细解决方案

HateoasConfiguration required a single bean, but 17 were found

热度:40   发布时间:2023-09-27 15:58:38.0

错误长相:

***************************
APPLICATION FAILED TO START
***************************Description:Parameter 0 of method linkDiscoverers in org.springframework.hateoas.config.HateoasConfiguration required a single bean, but 17 were found:
...

此错误可现于 Swagger + HATEOAS 项目中。解决方法是添加 LinkDiscoverers 的 bean:

@Bean
public LinkDiscoverers discoverers() {
    List<LinkDiscoverer> plugins = new ArrayList<>();plugins.add(new CollectionJsonLinkDiscoverer());return new LinkDiscoverers(SimplePluginRegistry.create(plugins));}

原文

  相关解决方案