如何更改 swagger-ui.html 默认路径

Che*_*ang 8 swagger-ui spring-boot swagger-2.0

我想改变我的招摇的UI从路径localhost:8080/swagger-ui.htmllocalhost:8080/myapi/swagger-ui.htmlspringboot 重定向是无奈的我

小智 16

在Spring Boot的application.properties中

springdoc.swagger-ui.path=/swagger-ui-custom.html
Run Code Online (Sandbox Code Playgroud)

在你的情况下它将是

springdoc.swagger-ui.path=/myapi/swagger-ui.html
Run Code Online (Sandbox Code Playgroud)


小智 -3

如果您使用的是 Spring Boot,请更新 application.properties 文件并写入此处

server.servlet.context-path=/myapi
Run Code Online (Sandbox Code Playgroud)

它会根据您的需要重定向您。