解决springdoc-openapi-ui(Swagger3)跳转默认界面问题

文章目录

问题现象

项目正确引入springdoc-openapi-ui依赖,但是访问/swagger-ui/index.html界面时,跳转到了默认的界面,如下图所示:

解决方法

1、升级maven依赖为1.8.0以上:

xml 复制代码
<dependency>
	<groupId>org.springdoc</groupId>
	<artifactId>springdoc-openapi-ui</artifactId>
	<version>1.8.0</version>
</dependency>

2、增加springdoc的url配置:

yaml 复制代码
springdoc:
  swagger-ui:
    enabled: true # 开启swagger界面
    url: /cxhl/v3/api-docs # 自定义搜索路径
    #path: swagger-ui.html # 自定义路径,默认为"/swagger-ui/index.html"

修改后的界面,如下图所示:

项目中的接口文档都出来了,完美解决!

相关推荐
2601_962106643 小时前
【Java Set综合实战】商品管理系统 + 图书收藏系统|Product、Book自定义类全套代码
java
RuoyiOffice3 小时前
SpringBoot+Vue3 凭证生命周期设计:审核、过账、冲销与反过账怎样保持账目一致
java·spring boot·事务·springboot3·财务系统·会计凭证·ruoyi office
2601_962106644 小时前
HashMap入门|工号-姓名键值存储、两种遍历方式、根据key/value查
java
RuoyiOffice4 小时前
KubeSphere 容器云实践:从管理 K8s 到建设企业 PaaS,还需要哪些能力
spring boot·kubernetes·kubesphere·jenkins·paas·微服务部署·ruoyi office
杨凯凡4 小时前
Spring Framework 7 API 版本管理实战:请求头路由、兼容迁移与废弃策略
java·rest api·springframework·spring boot 4·api版本管理
T_Wizard5 小时前
同一个问题写了 4 遍:官方 SDK / HTTP / Spring AI / LangChain4j,到底该选哪个
java·ai编程
hai_android5 小时前
AudioTrack 深度解析:从原理到实战
android·java·kotlin
斯维赤5 小时前
限流、熔断、降级,你真的分得清吗?
java·后端·架构
aiks_yuan8 小时前
Java CPU 100% 怎么排查:JDK 11 起 jstack 自带线程 CPU 时间,不用再 top -H 换算十六进制(JDK 8、11、17 实测)
java
Flynn Liang9 小时前
AiServices 源码级拆解:一个接口如何变成 RAG Agent
java·langchain·源码分析·rag·langchain4j·aiservices