Swagger: Whitelabel Error Page.No mapping for GET /swagger-ui.html

created at 05-29-2022 views: 46


After the SpringBoot project introduces Swagger2, enter the address in the browser address: http://ip:port/swagger-ui.html error:

Whitelabel Error Page

Looking at the background console, I found this error:

WARN o.s.web.servlet.PageNotFound -No mapping for get /swagger-ui.html

reason and solution

After analysis, it is found that the default Swagger static resource is overwritten and the configuration is missing because the configuration annotation class (@Configuration) in the project inherits WebMvcConfigurationSupport.

You can explicitly add the following swagger static resources in the inheritance configuration class:



Package, deploy and restart, and it will work.

created at:05-29-2022
edited at: 05-30-2022: