欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

【若依(ruoyi)】swagger 自定义 swagger-ui.html 的路径

发布时间:2024/9/19 81 豆豆
生活随笔 收集整理的这篇文章主要介绍了 【若依(ruoyi)】swagger 自定义 swagger-ui.html 的路径 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

前言

  • springfox-swagger 2.9.2
  • spring boot 2.2.13.RELEASE
  • http://springfox.github.io/springfox/

自定义 swagger-ui.html 的路径

默认的路径:http://localhost:8080/swagger-ui.html
如果想修改这个路径为:http://localhost:8080/rest/api/doc/swagger-ui.html,就需要自定义 swagger-ui.html 的路径。

方法1

可以参考这里(https://github.com/springfox/springfox/issues/1080),方法很多。
但修改的结果是,增加访问路径 http://localhost:8080/rest/api/doc/swagger-ui.html,但无法将原来的路径禁用掉。因为/swagger-resources/configuration/ui路径是硬编码在js里了,参考这里:https://github.com/springfox/springfox/blob/master/springfox-swagger-ui/src/web/js/springfox.js#L4。

方法2

参考这里:https://www.jianshu.com/p/ce7e247515f5。提供了修改js的方法,即解决了方法1中未解决的问题。

参考

https://blog.csdn.net/u014207158/article/details/89947199
https://github.com/springfox/springfox/issues/1080
https://www.jianshu.com/p/ce7e247515f5

总结

以上是生活随笔为你收集整理的【若依(ruoyi)】swagger 自定义 swagger-ui.html 的路径的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。