Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Question - Swagger UI and Swagger Services on different Servers #1001
I can access the /api-docs path on both services. However I can't figure out how to configure Swagger UI accordingly.
I probably found a solution by reading through old issues:
I created my own ApiResourceController (Basically I copied the one from springfox and removed all the DocumentationCache stuff). I then changed the swaggerResource() method to return my services:
Obviously this is not the best solution, because I don't want to hardcode my resources. I guess I'll write some kind of registry which is called by each service on startup.
Since spring will complain about duplicated resource mappings I had to ignore the existing ApiResourceController by adding the excludeFilters to my ComponentScan annotation:
Another thing that needs to be done, is to enable CORS, which can be done by writing an own CORS Filter as described here: https://spring.io/guides/gs/rest-service-cors/
This is however not working in my current application. So If someone has an idea what might go wrong here, please let me know
which looks fine for me. I have no clue why this is not working
I am having the similar kind of requirement. I have created ApiResourceController in my local. But i am not able to exclude springfox.documentation.swagger.web.ApiResourceController.class, using the below.
ITs still failing with the below error.
Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'apiResourceController' for bean class [springfox.documentation.swagger.web.ApiResourceController] conflicts with existing, non-compatible bean definition of same name and class [************.local..ApiResourceController]