程序员の奇妙冒险

返回
Spring Boot Spring Boot
2025-11-24 11:30 阅读:237 评论:0

Spring Boot 3.5.7版本项目升级为 4.0.0最新版本配置以及依赖包变动

配置 新增全局配置启用虚拟线程 依赖 AOP依赖包变动 依赖包变动参考:https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide image MultipartConfigFactory工厂

配置

新增全局配置启用虚拟线程

1
2
3
4
5
spring:
threads:
virtual:
# 开启虚拟线程
enabled: true

依赖

AOP依赖包变动

1
2
3
4
5
6
7
8
9
10
11
--- AOP
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
 
--- AOP Spring Boot 4.0.0
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aspectj</artifactId>
</dependency>
  • 依赖包变动参考:https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide

image

MultipartConfigFactory工厂包名变动

1
2
org.springframework.boot.web.servlet.MultipartConfigFactory
org.springframework.boot.servlet.MultipartConfigFactory
  • 核心依赖包
1
2
3
4
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc</artifactId>
</dependency>

异常处理

1
2
3
4
5
6
7
8
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
17:57:16.757 logback [main] ERROR o.s.boot.SpringApplication - Application run failed
java.lang.IllegalStateException: Failed to generate bean name for imported class 'org.redisson.spring.starter.RedissonAutoConfigurationV2'
 
 
 
Caused by: java.lang.IllegalArgumentException: Could not find class [org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration]
at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:353)
  • redisson 与当前Spring Boot 版本不兼容,目前redisson starter最新版本是 3.52.0,此版本未适配Spring boot 4
  • 查看redisson官方适配Spring boot对应版本 https://redisson.pro/docs/integration-with-spring/#spring-boot-starter
评论 (0)
暂无评论 来抢沙发吧~