Home > Software engineering >  Swagger. "No handler found" error (SimpleUrlHandlerMapping not injected)
Swagger. "No handler found" error (SimpleUrlHandlerMapping not injected)

Time:11-12

When I try to access the Swagger UI page (.../service-name/swagger-ui.html) I receive No handler found for GET ... error.

enter image description here

I did some research and found out that SimpleUrlHandlerMapping bean, which is required for swagger page to work not created by Spring. Here is an example of the correctly working service, breakpoint at BeanFactoryUtils.java:378: enter image description here

enter image description here

And here is an example of the actual behavior of my app, where the needed bean was not created: enter image description here

Bean not found

These two applications use the same spring and swagger version, also, swagger configurations are completely similar. Can you help me to find out why is it happening? The weird part here is even if I reset my branch to the date when I am 100% sure that swagger-ui worked, I still receive this error, maybe some internal Spring caching is involved?

Thank you in advance!

CodePudding user response:

I found an answer here. My app had two configurations based on WebMvcConfigurer and WebMvcConfigurationSupport, this caused some issues during the context creation. The solution here is that you need to use only one type of configuration

  • Related