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

Springfox与Spring Boot 3.0.2兼容版本咨询

Spring Boot 3.0.2 兼容的Swagger方案(替代Springfox)
  • Springfox 3.x 完全不兼容 Spring Boot 3 系列版本,核心原因是Spring Boot 3基于Jakarta EE API,而Springfox仍依赖旧的Java EE(javax.*)规范,底层依赖不匹配导致Swagger UI无法正常加载,这也是你切换回Spring Boot 2.7.8就能正常运行的原因。
  • 注意:Springfox项目已停止维护(最后更新在2021年),官方没有计划推出适配Spring Boot 3的版本。
  • 针对Spring Boot 3.0.2,推荐使用Springdoc OpenAPI作为替代,这是目前活跃维护、完全适配Spring Boot 3的Swagger工具:
    1. 引入Maven依赖(适配Spring Boot 3的稳定版本):
      <dependency>
          <groupId>org.springdoc</groupId>
          <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
          <version>2.2.0</version>
      </dependency>
      
    2. 默认无需额外配置,启动项目后访问 http://localhost:8080/swagger-ui.html 即可打开Swagger UI界面。
    3. 若需自定义文档信息、安全认证等,可通过创建OpenAPI类型的Bean实现配置。

内容的提问来源于stack exchange,提问作者Sahana S

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.01 18:01:24