Swagger:Unable to infer base url. This is common when using dynamic servlet registration or when...

问题描述

Springboot 集成swagger2时遇到的问题:

打开:http://localhost:8080/swagger-ui.html 报如下信息:

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:

如图:
在这里插入图片描述

解决办法:

启动类(Application.java)加上 @EnableSwagger2 注解,如:
在这里插入图片描述
相关文章:
swagger2注解详解及案例:https://blog.csdn.net/qq_26482855/article/details/121511373


版权声明:本文为qq_26482855原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。