spring 在微服务中的Sping Boot 项目中设置Swagger

l5tcr1uw  于 12个月前  发布在  Spring
关注(0)|答案(1)|浏览(146)

我正在开发一个由以下应用程序组成的微服务项目:-Discovery Server -Gateway -Elemental Service(主微服务)-Chat Service(真实的管理聊天的微服务)。
现在,我想设置Swagger,以便访问URI http://localhost:8080/swagger-ui/可以看到所有微服务API。
我尝试设置以下依赖项:

<dependency>
   <groupId>org.springdoc</groupId>         
   <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
   <version>2.0.0</version>       
</dependency>

在我的项目的pom.xml和我的网关的pom.xml中,但我仍然无法访问Swagger。
如果我访问Swagger页面,我会得到404错误。
我该怎么解决呢?先谢了。

svmlkihl

svmlkihl1#

URL通常应该是http://localhost:8080/swagger-ui/index.html或类似的URL,具体取决于您的上下文路径和配置。

相关问题