0

当我在 kubernetes 环境中部署后尝试访问我的 swagger url 时,我遇到了这个错误消息。

当我在 localhost 上运行我的 Spring Boot 应用程序时,我能够看到招摇而没有任何错误。

我使用 Traefik 作为我的入口控制器。

4

1 回答 1

1

Spring Boot 应用程序,您必须在 application.yml/perporties 文件中添加服务器上下文路径。

例子:

服务器:servlet:上下文路径:/

添加 context-path 后,您可以看到 swagger-ui url:localhost:8080/api/swagger-ui.html

注意:根路径名称为“api”,您已在 Ingress.yml 文件中配置。

规范:规则:-主机:http:路径:-路径:/api 后端:服务名称:

于 2019-09-26T06:30:04.873 回答