错误信息

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配置类了

Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐