Search code examples
spring-bootswagger-uispring-hateoas

Integration Test Started failing post Spring boot 2.2.0 upgrade with Swagger latest version 2.9.2 & HATEOS


Integration Test Started failing post Spring boot 2.2.0 upgrade with Swagger latest version 2.9.2 & HATEOS

java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'linkDiscoverers' 
defined in class path resource [org/springframework/hateoas/config/HateoasConfiguration.class]: 
Unsatisfied dependency expressed through method 'linkDiscoverers' parameter 0; 
nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException:
No qualifying bean of type 'org.springframework.plugin.core.PluginRegistry<org.springframework.hateoas.client.LinkDiscoverer,
org.springframework.http.MediaType>' available: expected single matching bean but 
found 3: relProviderPluginRegistry,linkDiscovererRegistry,entityLinksPluginRegistry
Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: 
No qualifying bean of type 'org.springframework.plugin.core.PluginRegistry<org.springframework.hateoas.client.LinkDiscoverer, 
org.springframework.http.MediaType>' available: expected single matching bean but found 3: 
relProviderPluginRegistry,linkDiscovererRegistry,entityLinksPluginRegistry

Solution

  • The issue with springfox may take while to resolve issue but there is alternative available with latest swagger v3 have similar capabilities of springfox

    https://github.com/springdoc/springdoc-openapi.git

    Only disabled the SpringFox dependencies, added SpringDoc, and replaced the SpringFox bean, with a SpringDoc bean. Everything is working as expected. All I need to do is to convert a couple of annotations on each rest service so SpringDoc displays everything correctly. SpringDoc does work