You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spring Boot 3.0.0-SNAPSHOT集成springdoc-openapi-ui失败求助

Spring Boot 3.0.0-SNAPSHOT 中 springdoc-openapi-ui 无法正常工作的解决方案
  • 核心问题:Spring Boot 3.x 基于Jakarta EE API,而你当前使用的springdoc-openapi-ui 1.6.12仅适配Spring Boot 2.x(基于Java EE),API规范不兼容导致功能失效。

  • 修复方案:

    1. 升级springdoc依赖版本并更换依赖名:使用支持Spring Boot 3.x的版本(最低2.0.0+),同时Spring Boot 3.x对应的springdoc starter依赖名称已更新,修改配置如下:

      id 'org.springframework.boot' version '3.0.0-SNAPSHOT'
      implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.2.0'
      

      若你的项目是WebFlux架构,替换为springdoc-openapi-starter-webflux-ui即可。

    2. 调整访问路径:新版springdoc在Spring Boot 3.x下的默认Swagger UI路径为http://localhost:8080/swagger-ui/index.html,如果项目有/user上下文路径,访问地址改为http://localhost:8080/user/swagger-ui/index.html。

  • 验证步骤:重启项目后访问调整后的路径,检查Swagger UI是否正常加载展示接口文档。

内容的提问来源于stack exchange,提问作者Ayshan Rzayeva

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.11 22:20:29