访问:http://localhost:8001/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:
解决办法:
1.检查swagger配置类上是否有一下注解
@Configuration//配置类
@EnableSwagger2//swagger注解
2.检查springboot的启动类上是否有以下注解:
@SpringBootApplication
@ComponentScan(basePackages = {"com.sun"})//扫描包名为com.sun的部分,实现多模块应用
@EnableSwagger2
完成后,再访问:http://localhost:8001/swagger-ui.html,