Swagger-UI 提示Unable to infer base url.

错误信息为:

Unable to infer base url.
This is common when using dynamic servlet registration or when the API is behind an API Gateway.
The base url is the root of where all the swagger resources are served. For e.g. if the api is available at http://example.org/api/v2/api-docs then the base url is http://example.org/api/.
Please enter the location manually:

Swagger-UI 提示Unable to infer base url._第1张图片

刚开始我以为是浏览器问题,运气不佳。经过排查总结了2个问题:

1,版本问题:2.8以后的版本很容易出现这类问题。

2,在application启动类中未定义@EnableSwagger2注解

你可能感兴趣的:(java)