feat: Spring Boot 3.5.14 → 4.0.6 升级

核心升级:
- Spring Boot 3.5.14 → 4.0.6
- Spring Framework 6.2.18 → 7.0.7
- Spring Security 6.5.10 → 7.0.5
- Flyway 11.7.2 → 11.14.1

Breaking Changes 适配:
- starter-aop → starter-aspectj (SB4 重命名)
- JDBC/Flyway/Jackson 自动配置拆分到独立模块
- DaoAuthenticationProvider 构造函数变更 (Spring Security 7.0)
- DataSourceProperties 包路径迁移

依赖调整:
- Druid boot3-starter → druid core (手动配置, 避免 SB4 不兼容)
- 新增 spring-boot-starter-quartz
- 新增 spring-boot-starter-cache
- 新增 spring-boot-flyway / spring-boot-jdbc
- PostgreSQL 42.7.4 → 42.7.10

验证: 26/26 测试通过, 1374 API端点正常
This commit is contained in:
2026-06-05 08:43:30 +08:00
parent 1d21661a78
commit 554e20f276
13 changed files with 461 additions and 65 deletions

View File

@@ -22,6 +22,16 @@
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- SB4: Flyway + JDBC 自动配置拆分到独立模块 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-flyway</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-jdbc</artifactId>
</dependency>
<!-- Flyway 数据库迁移 -->
<dependency>
<groupId>org.flywaydb</groupId>
@@ -79,12 +89,6 @@
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
</dependency>
<!-- rabbitMQ -->
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency> -->
</dependencies>

View File

@@ -3,8 +3,8 @@ package com.openhis;
import com.openhis.web.ybmanage.config.YbServiceConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.flyway.autoconfigure.FlywayAutoConfiguration;
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
@@ -13,25 +13,14 @@ import org.springframework.scheduling.annotation.EnableAsync;
import java.net.InetAddress;
import java.net.UnknownHostException;
/**
* 启动程序
*
* @author system 1234
*/
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, FlywayAutoConfiguration.class}, scanBasePackages = {"com.core", "com.openhis"})
@SpringBootApplication(exclude = {
DataSourceAutoConfiguration.class,
FlywayAutoConfiguration.class
}, scanBasePackages = {"com.core", "com.openhis"})
@EnableConfigurationProperties(YbServiceConfig.class)
@EnableAsync
public class OpenHisApplication {
public static void main(String[] args) throws UnknownHostException {
// System.setProperty("spring.devtools.restart.enabled", "false");
// 测试 Instrument 类加载
// try {
// Class.forName("com.openhis.administration.domain.Instrument");
// System.out.println("Instrument class loaded successfully");
// } catch (ClassNotFoundException e) {
// System.err.println("Failed to load Instrument class: " + e.getMessage());
// }
ConfigurableApplicationContext application = SpringApplication.run(OpenHisApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();

View File

@@ -5,7 +5,7 @@ import org.flywaydb.core.Flyway;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer;
import org.springframework.boot.flyway.autoconfigure.FlywayMigrationInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@@ -6,7 +6,7 @@ package com.openhis;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
import java.io.IOException;