转:springboot 与swagger整合出现Unable to infer base url.This is common when using dynamic的解决办法

原文链接:https://blog.csdn.net/miachen520/article/details/95718639

今天在springboot与swagger整合测试的时候跳出如下所示界面

 

经查资料发现有两种解决办法,

1.直接把@EnableSwagger2注解加在主启动类就可以,这样虽然能解决问题,但是这样会扫到使用的框架的接口,

这种方法要慎用。

2.主启动类加上@ComponentScan("swagger配置类所在包"),以保证配置类被扫描到 

 

最后解决问题之后就可以访问 你的配置文件的相关端口了,http://localhost:8763/swagger-ui.html ,这里的端口和ip根据实际情况来

posted on 2020-01-20 19:13  happy刘艺  阅读(3134)  评论(0编辑  收藏  举报

导航