SpringBoot 3.5.10引入springdoc-openapi-starter-webmvc-ui版本

SpringBoot 3.5.10 引入openapi 3.0.1包,包版本过高报错;

pom.xml

xml 复制代码
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
            <version>3.0.1</version>
            <scope>compile</scope>
        </dependency>

版本过高 编译即报错 编译失败:

复制代码
***************************
APPLICATION FAILED TO START
***************************

Description:

The bean 'conventionErrorViewResolver', defined in class path resource [org/springframework/boot/webmvc/autoconfigure/error/ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

Disconnected from the target VM, address: '127.0.0.1:60346', transport: 'socket'

SpringBoot 3.5.10 引入openapi 2.6.0包,openapi包版本过低报错;

xml 复制代码
 <!-- SpringDoc OpenAPI(接口文档,替代Swagger2) -->
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
			<version>2.6.0</version>
            <scope>compile</scope>
        </dependency>

版本过低:

服务器内部错误:Handler dispatch failed: java.lang.NoSuchMethodError: 'void o

实践结论:

jdk17 ,springboot3.5.10 ,使用openapi 版本在 2.7.0 - 2.8.15 区间的都可以。

相关推荐
大模型玩家七七6 小时前
基于语义切分 vs 基于结构切分的实际差异
java·开发语言·数据库·安全·batch
Coder_Boy_7 小时前
技术发展的核心规律是「加法打底,减法优化,重构平衡」
人工智能·spring boot·spring·重构
牛奔7 小时前
Go 如何避免频繁抢占?
开发语言·后端·golang
寻星探路11 小时前
【深度长文】万字攻克网络原理:从 HTTP 报文解构到 HTTPS 终极加密逻辑
java·开发语言·网络·python·http·ai·https
想用offer打牌12 小时前
MCP (Model Context Protocol) 技术理解 - 第二篇
后端·aigc·mcp
曹牧13 小时前
Spring Boot:如何测试Java Controller中的POST请求?
java·开发语言
KYGALYX13 小时前
服务异步通信
开发语言·后端·微服务·ruby
掘了13 小时前
「2025 年终总结」在所有失去的人中,我最怀念我自己
前端·后端·年终总结
爬山算法14 小时前
Hibernate(90)如何在故障注入测试中使用Hibernate?
java·后端·hibernate