错误信息
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配置类上是否加了@EnableSwagger2注解
2、微服务调用,模块1调用模块2中的swagger配置类,由于模块之间的包路径不一致,导致模块1找不到模块2中的swagger配置类,因此报错。
解决:在模块1的启动类上添加包扫描路径,@ComponentScan(basePackages = {模块1路径,模块2路径}),这样就能扫描到模块2中的swagger配置类了