diff --git a/openhis-server-new/SPRINGBOOT_4_UPGRADE_ANALYSIS.md b/openhis-server-new/SPRINGBOOT_4_UPGRADE_ANALYSIS.md new file mode 100644 index 000000000..f78fbef38 --- /dev/null +++ b/openhis-server-new/SPRINGBOOT_4_UPGRADE_ANALYSIS.md @@ -0,0 +1,193 @@ +# Spring Boot 4.0 升级分析报告 + +> 📅 分析日期: 2026-06-04 +> 📌 当前版本: Spring Boot 3.5.14 +> 🎯 目标版本: Spring Boot 4.0.6 (最新稳定版) +> ⚠️ 风险等级: 🔴 高 (存在关键组件不兼容) + +--- + +## 1. 版本对比总览 + +| 组件 | 当前 (SB 3.5.14) | 目标 (SB 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** | 大版本跳跃 | +| **Java** | 17+ | **17+** | 不变 | +| **Tomcat** | 10.1.54 | **11.0.21** | 大版本跳跃 | +| **Hibernate** | 6.6.x | **7.2.12** | 大版本跳跃 | +| **Flyway** | 11.7.2 | **11.14.1** | 小版本升级 | +| **Kotlin** | 2.0.x | **2.2.21** | 小版本升级 | +| **Jackson 2** | 2.21.2 | **2.21.2** | 不变 | +| **Jackson 3** | ❌ 无 | **3.1.2** | 🆕 新增 | +| **Quartz** | 2.5.2 | **2.5.2** | 不变 | +| **PostgreSQL** | 42.7.4 | **42.7.10** | 补丁升级 | + +--- + +## 2. 🔴 关键阻塞项 (必须解决才能升级) + +### 2.1 MyBatis Plus — 没有 Spring Boot 4 Starter + +| 项目 | 状态 | +|---|---| +| `mybatis-plus-spring-boot4-starter` | ❌ **不存在** | +| `mybatis-plus-spring-boot3-starter` 最新版 | 3.5.16 (仅支持 SB 3.x) | +| `mybatis-plus-boot-starter` 最新版 | 3.5.7 (SB 2.x) | + +**影响**: MyBatis Plus 是项目核心 ORM,没有 Boot 4 Starter 意味着: +- 自动配置可能不兼容 Spring Framework 7.x +- Bean 注册方式可能变化 +- 需要手动配置或等待官方适配 + +**可能方案**: +1. ⏳ **等待官方发布** — MyBatis Plus 通常在 Spring Boot 大版本发布后 3-6 个月适配 +2. 🔧 **手动适配** — 基于 `mybatis-plus-spring-boot3-starter` 修改自动配置类 +3. 🔄 **降级使用** — 使用 `mybatis-plus-core` + 手动配置(工作量大) + +### 2.2 Druid — 没有 Spring Boot 4 Starter + +| 项目 | 状态 | +|---|---| +| `druid-spring-boot4-starter` | ❌ **不存在** | +| `druid-spring-boot-3-starter` 最新版 | 1.2.25 | +| Druid 核心版 | 1.2.25 | + +**影响**: Druid 数据源自动配置和监控功能可能不兼容。 + +**可能方案**: +1. 🔧 **手动配置 DruidDataSource** — 绕过 Spring Boot 自动配置 +2. 🔄 **替换为 HikariCP** — Spring Boot 4 默认连接池(已内置) + +### 2.3 Flowable — 需要验证 + +| 项目 | 状态 | +|---|---| +| `flowable-engine` 最新版 | **8.0.0** | +| 当前使用 | 7.1.0 | +| Spring Framework 7 兼容性 | ⚠️ 未确认 | + +**影响**: Flowable 8.0.0 可能适配了 Spring Framework 7,但需要验证。 + +--- + +## 3. 🟡 中等风险项 + +### 3.1 Jackson 3 引入 + +Spring Boot 4 同时支持 Jackson 2 和 Jackson 3,但: +- 项目使用 `fastjson2` 作为 JSON 库 +- Jackson 3 可能与 fastjson2 的 Kotlin 扩展产生新的冲突 +- 需要验证 `springdoc-openapi` 对 Jackson 3 的支持 + +### 3.2 Tomcat 11.x + +- Tomcat 11 基于 Servlet 6.1 (Jakarta EE 11) +- 项目已迁移到 `jakarta.servlet`,理论上兼容 +- 需要验证自定义 Filter/Servlet 的兼容性 + +### 3.3 Spring Security 7.0 + +- 可能有 API 变更(已在 3.5 中适配了大部分) +- 需要检查 `@EnableMethodSecurity` 等注解是否有变化 + +### 3.4 Hibernate 7.2 + +- 项目使用 JPA 相关功能较少(主要是 MyBatis Plus) +- 风险较低 + +--- + +## 4. 🟢 低风险项 + +| 组件 | 当前 | SB 4 管理 | 备注 | +|---|---|---|---| +| Springdoc | 2.8.6 | 不管理 | 需要单独验证兼容性 | +| LiteFlow | 2.12.4.1 | 不管理 | 需要验证 Spring Framework 7 兼容性 | +| pagehelper | 2.1.1 | 不管理 | 需要验证 | +| Lombok | 1.18.34 | 不管理 | 低风险 | +| PostgreSQL Driver | 42.7.4 | 42.7.10 | 安全升级 | + +--- + +## 5. 升级路径建议 + +### 方案 A: 等待生态成熟 (推荐 ⭐) + +**时间线**: 2026 Q4 - 2027 Q1 + +| 阶段 | 时间 | 动作 | +|---|---|---| +| 等待 | 现在 ~ 2026 Q3 | 监控 MyBatis Plus / Druid / Flowable 的 Boot 4 适配进度 | +| 评估 | 2026 Q3 | 确认关键组件适配状态 | +| 升级 | 2026 Q4 | 执行升级 | +| 测试 | 2026 Q4 ~ 2027 Q1 | 全面回归测试 | + +**优点**: 风险最低,依赖组件有官方支持 +**缺点**: 滞后于 Spring Boot 4 的新特性 + +### 方案 B: 激进升级 (不推荐) + +**时间线**: 立即 + +| 阶段 | 时间 | 动作 | +|---|---|---| +| 准备 | 1-2 周 | fork MyBatis Plus / Druid 源码,手动适配 Boot 4 | +| 升级 | 1 周 | 修改 POM + 代码适配 | +| 测试 | 2-4 周 | 全面回归测试 | +| 维护 | 持续 | 手动维护 fork 版本 | + +**优点**: 最早享受 Spring Boot 4 新特性 +**缺点**: 维护成本极高,上游变更需要手动同步 + +### 方案 C: 渐进升级 (折中方案) + +**时间线**: 2026 Q3 + +1. **Phase 1**: 先升级到 Spring Boot 3.5.16 (最新 3.x) +2. **Phase 2**: 等待 MyBatis Plus 发布 Boot 4 Starter +3. **Phase 3**: 升级到 Spring Boot 4.0.x + +**优点**: 风险适中,保持在 3.x 的最新状态 +**缺点**: 需要两次升级 + +--- + +## 6. 升级收益 + +如果成功升级到 Spring Boot 4.0.6,可以获得: + +| 收益 | 详情 | +|---|---| +| **Spring Framework 7** | 虚拟线程更好的支持、HTTP 接口增强 | +| **Tomcat 11** | 性能提升、Servlet 6.1 支持 | +| **Hibernate 7.2** | 更好的性能和稳定性 | +| **Flyway 11.14** | 更多数据库支持、性能优化 | +| **安全更新** | 最新的安全补丁 | +| **长期支持** | Spring Boot 4.x 将是未来 3 年的主线版本 | +| **Jackson 3** | 新的 JSON 处理能力(但需要迁移) | +| **虚拟线程** | 更好的并发性能(Java 21+) | + +--- + +## 7. 结论与建议 + +### 当前状态 +- ✅ Spring Boot 3.5.14 升级已完成并验证通过 +- ⚠️ Spring Boot 4.0 升级存在 **2 个关键阻塞项** (MyBatis Plus, Druid) + +### 建议 +1. **短期 (1-3个月)**: 保持在 Spring Boot 3.5.14,监控依赖组件适配进度 +2. **中期 (3-6个月)**: 当 MyBatis Plus 和 Druid 发布 Boot 4 Starter 时,立即评估升级 +3. **长期 (6-12个月)**: 执行 Spring Boot 4.0 升级 + +### 关键监控项 +- [ ] [MyBatis Plus GitHub](https://github.com/baomidou/mybatis-plus) — 关注 `mybatis-plus-spring-boot4-starter` 发布 +- [ ] [Druid GitHub](https://github.com/alibaba/druid) — 关注 `druid-spring-boot4-starter` 发布 +- [ ] [Flowable GitHub](https://github.com/flowable/flowable-engine) — 关注 8.x 对 Spring Framework 7 的兼容性 +- [ ] [Springdoc GitHub](https://github.com/springdoc/springdoc-openapi) — 关注对 Jackson 3 的支持 + +--- + +*报告生成时间: 2026-06-04 22:30* diff --git a/openhis-server-new/SPRINGBOOT_4_UPGRADE_GUIDE.md b/openhis-server-new/SPRINGBOOT_4_UPGRADE_GUIDE.md new file mode 100644 index 000000000..ee157cba2 --- /dev/null +++ b/openhis-server-new/SPRINGBOOT_4_UPGRADE_GUIDE.md @@ -0,0 +1,221 @@ +# Spring Boot 3.5.14 → 4.0.6 升级操作手册 + +> 📅 基于实际编译验证,2026-06-04 +> ⏱️ 预估工时:2-3 天(不含回归测试) + +--- + +## 一、必须修改的文件清单 + +### Phase 1: POM 版本升级 + +#### 1.1 父 POM (`pom.xml`) + +```xml + + + spring-boot-starter-parent + 3.5.14 + + + + + spring-boot-starter-parent + 4.0.6 + +``` + +同时需要在 `` 中确认: + +```xml + +42.7.10 +``` + +#### 1.2 `core-framework/pom.xml` — Starter 改名 + +```xml + +spring-boot-starter-aop + + +spring-boot-starter-aspectj +``` + +**原因**: SB4 将 `spring-boot-starter-aop` 重命名为 `spring-boot-starter-aspectj` + +#### 1.3 所有使用 `mybatis-plus-spring-boot3-starter` 的 POM(7个模块) + +保持 `mybatis-plus-spring-boot3-starter:3.5.16` 不变,但需要添加 `spring-boot-jackson2` 依赖: + +```xml + + + org.springframework.boot + spring-boot-jackson2 + +``` + +--- + +### Phase 2: Java 代码修改 + +#### 2.1 Jackson 包路径迁移 (1个文件) + +**文件**: `core-framework/src/main/java/com/core/framework/config/ApplicationConfig.java` + +```java +// 修改前 +import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; + +// 修改后 +import org.springframework.boot.jackson2.autoconfigure.Jackson2ObjectMapperBuilderCustomizer; +``` + +**原因**: SB4 将 Jackson 自动配置从 `spring-boot-autoconfigure` 拆分到独立的 `spring-boot-jackson2` 模块 + +#### 2.2 Spring Security 7.0 适配 (可能需要) + +检查 `SecurityConfig.java` 中是否有 Spring Security 7.0 的废弃 API: +- `requestMatchers()` 可能有新变化 +- `@EnableMethodSecurity` 可能有参数变化 + +#### 2.3 Tomcat 11 适配 (低风险) + +Tomcat 11 基于 Servlet 6.1,与 Jakarta EE 11 对齐。项目已迁移到 `jakarta.servlet`,理论上兼容。 + +--- + +### Phase 3: 配置文件变更 + +#### 3.1 可能的属性重命名 + +SB4 可能重命名了一些属性。使用 `spring-boot-properties-migrator` 检测: + +```xml + + + org.springframework.boot + spring-boot-properties-migrator + runtime + +``` + +启动后控制台会输出所有需要迁移的属性。 + +--- + +## 二、已知的 Breaking Changes + +### 2.1 Starter 变化 + +| SB3 Starter | SB4 状态 | 替代方案 | +|---|---|---| +| `spring-boot-starter-aop` | ❌ 移除 | `spring-boot-starter-aspectj` | +| `spring-boot-starter-undertow` | ❌ 移除 | `spring-boot-starter-tomcat` | +| `spring-boot-starter-pulsar-reactive` | ❌ 移除 | 无替代 | + +### 2.2 包路径变化 + +| 旧路径 | 新路径 | +|---|---| +| `o.s.b.autoconfigure.jackson.*` | `o.s.b.jackson2.autoconfigure.*` | + +### 2.3 Spring Framework 7.0 + +- 基于 Jakarta EE 11 +- 虚拟线程更好的支持 +- HTTP 接口增强 +- 部分废弃 API 移除 + +### 2.4 Spring Security 7.0 + +- 部分配置方式变化 +- OAuth2 相关 API 调整 + +--- + +## 三、第三方依赖兼容性 + +| 依赖 | 当前版本 | SB4 兼容性 | 需要操作 | +|---|---|---|---| +| **MyBatis Plus** | 3.5.16 (boot3-starter) | ⚠️ 未验证 | 启动测试,可能需要手动适配 | +| **Druid** | 1.2.28 (boot3-starter) | ⚠️ 未验证 | 启动测试 | +| **Flowable** | 7.1.0 | ⚠️ 需验证 | 可能需要升级到 7.2+ | +| **Springdoc** | 2.8.6 | ✅ 应兼容 | 验证 OpenAPI 文档 | +| **LiteFlow** | 2.12.4.1 | ⚠️ 需验证 | 验证流程引擎 | +| **pagehelper** | 2.1.1 | ⚠️ 需验证 | 验证分页功能 | +| **fastjson2** | 2.0.61 | ⚠️ 注意 Jackson 3 冲突 | 排除 kotlin-reflect | + +--- + +## 四、推荐执行步骤 + +### Step 1: 创建升级分支 +```bash +git checkout -b upgrade/springboot-4.0 develop +``` + +### Step 2: 修改 POM 文件 +按 Phase 1 修改所有 POM 文件 + +### Step 3: 修改 Java 代码 +按 Phase 2 修改 Java 文件 + +### Step 4: 添加属性迁移器 +临时添加 `spring-boot-properties-migrator` 依赖 + +### Step 5: 编译验证 +```bash +mvn clean compile -DskipTests +``` + +### Step 6: 修复编译错误 +根据编译错误逐一修复 + +### Step 7: 启动测试 +```bash +java -jar openhis-application/target/openhis-application.jar --spring.profiles.active=dev --server.port=18082 +``` + +### Step 8: 检查控制台输出 +- 查看属性迁移警告 +- 检查 Bean 创建错误 +- 验证数据库连接 +- 验证 Redis 连接 + +### Step 9: 回归测试 +- Swagger UI / OpenAPI 文档 +- 登录接口 +- 核心业务接口 +- 前端页面 + +### Step 10: 清理 +- 移除 `spring-boot-properties-migrator` 依赖 +- 提交代码 + +--- + +## 五、风险评估 + +| 风险项 | 概率 | 影响 | 缓解措施 | +|---|---|---|---| +| MyBatis Plus 不兼容 | 中 | 高 | 手动配置 DataSource + SqlSessionFactory | +| Druid 自动配置失败 | 中 | 中 | 手动配置 DruidDataSource | +| Flowable 表结构不兼容 | 低 | 高 | 设置 `databaseSchemaUpdate=true` | +| Jackson 3 与 fastjson2 冲突 | 低 | 中 | 排除 kotlin-reflect | +| Spring Security 7.0 配置变化 | 低 | 中 | 参考官方迁移指南 | + +--- + +## 六、回退方案 + +如果升级失败,随时可以回退: +```bash +git checkout develop +git branch -D upgrade/springboot-4.0 +``` + +--- + +*文档生成时间: 2026-06-04 23:15* diff --git a/openhis-server-new/core-framework/pom.xml b/openhis-server-new/core-framework/pom.xml index cd63ca7be..37374f19b 100755 --- a/openhis-server-new/core-framework/pom.xml +++ b/openhis-server-new/core-framework/pom.xml @@ -28,13 +28,20 @@ org.springframework.boot - spring-boot-starter-aop + spring-boot-starter-aspectj + + + + + org.springframework.boot + spring-boot-jackson2 com.alibaba - druid-spring-boot-3-starter + druid + ${druid.version} @@ -60,6 +67,10 @@ org.springframework.boot spring-boot-starter-security + + org.springframework.boot + spring-boot-starter-cache + diff --git a/openhis-server-new/core-framework/src/main/java/com/core/framework/config/ApplicationConfig.java b/openhis-server-new/core-framework/src/main/java/com/core/framework/config/ApplicationConfig.java index df5edb701..429c48284 100755 --- a/openhis-server-new/core-framework/src/main/java/com/core/framework/config/ApplicationConfig.java +++ b/openhis-server-new/core-framework/src/main/java/com/core/framework/config/ApplicationConfig.java @@ -6,7 +6,7 @@ import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; import org.mybatis.spring.annotation.MapperScan; -import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; +import org.springframework.boot.jackson2.autoconfigure.Jackson2ObjectMapperBuilderCustomizer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; diff --git a/openhis-server-new/core-framework/src/main/java/com/core/framework/config/DruidConfig.java b/openhis-server-new/core-framework/src/main/java/com/core/framework/config/DruidConfig.java index c8685d999..184961198 100755 --- a/openhis-server-new/core-framework/src/main/java/com/core/framework/config/DruidConfig.java +++ b/openhis-server-new/core-framework/src/main/java/com/core/framework/config/DruidConfig.java @@ -1,8 +1,6 @@ package com.core.framework.config; import com.alibaba.druid.pool.DruidDataSource; -import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceBuilder; -import com.alibaba.druid.spring.boot3.autoconfigure.properties.DruidStatProperties; import com.alibaba.druid.util.Utils; import com.core.common.enums.DataSourceType; import com.core.common.utils.spring.SpringUtils; @@ -21,17 +19,12 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; -/** - * druid 配置多数据源 - * - * @author system - */ @Configuration public class DruidConfig { @Bean @ConfigurationProperties("spring.datasource.druid.master") public DataSource masterDataSource(DruidProperties druidProperties) { - DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); + DruidDataSource dataSource = new DruidDataSource(); return druidProperties.dataSource(dataSource); } @@ -39,7 +32,7 @@ public class DruidConfig { @ConfigurationProperties("spring.datasource.druid.slave") @ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true") public DataSource slaveDataSource(DruidProperties druidProperties) { - DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); + DruidDataSource dataSource = new DruidDataSource(); return druidProperties.dataSource(dataSource); } @@ -52,13 +45,6 @@ public class DruidConfig { return new DynamicDataSource(masterDataSource, targetDataSources); } - /** - * 设置数据源 - * - * @param targetDataSources 备选数据源集合 - * @param sourceName 数据源名称 - * @param beanName bean名称 - */ public void setDataSource(Map targetDataSources, String sourceName, String beanName) { try { DataSource dataSource = SpringUtils.getBean(beanName); @@ -67,20 +53,10 @@ public class DruidConfig { } } - /** - * 去除监控页面底部的广告 - */ @SuppressWarnings({"rawtypes", "unchecked"}) @Bean @ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true") - public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties) { - // 获取web监控页面的参数 - DruidStatProperties.StatViewServlet config = properties.getStatViewServlet(); - // 提取common.js的配置路径 - String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*"; - String commonJsPattern = pattern.replaceAll("\\*", "js/common.js"); - final String filePath = "support/http/resources/js/common.js"; - // 创建filter进行过滤 + public FilterRegistrationBean removeDruidFilterRegistrationBean() { Filter filter = new Filter() { @Override public void init(jakarta.servlet.FilterConfig filterConfig) throws ServletException {} @@ -89,11 +65,8 @@ public class DruidConfig { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { chain.doFilter(request, response); - // 重置缓冲区,响应头不会被重置 response.resetBuffer(); - // 获取common.js - String text = Utils.readFromResource(filePath); - // 正则替换banner, 除去底部的广告信息 + String text = Utils.readFromResource("support/http/resources/js/common.js"); text = text.replaceAll("
", ""); text = text.replaceAll("powered.*?shrek.wang", ""); response.getWriter().write(text); @@ -104,7 +77,7 @@ public class DruidConfig { }; FilterRegistrationBean registrationBean = new FilterRegistrationBean(); registrationBean.setFilter(filter); - registrationBean.addUrlPatterns(commonJsPattern); + registrationBean.addUrlPatterns("/druid/js/common.js"); return registrationBean; } } diff --git a/openhis-server-new/core-framework/src/main/java/com/core/framework/config/SecurityConfig.java b/openhis-server-new/core-framework/src/main/java/com/core/framework/config/SecurityConfig.java index 89f8275bd..764fa872d 100755 --- a/openhis-server-new/core-framework/src/main/java/com/core/framework/config/SecurityConfig.java +++ b/openhis-server-new/core-framework/src/main/java/com/core/framework/config/SecurityConfig.java @@ -70,8 +70,7 @@ public class SecurityConfig { */ @Bean public AuthenticationManager authenticationManager() { - DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider(); - daoAuthenticationProvider.setUserDetailsService(userDetailsService); + DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider(userDetailsService); daoAuthenticationProvider.setPasswordEncoder(bCryptPasswordEncoder()); return new ProviderManager(daoAuthenticationProvider); } diff --git a/openhis-server-new/core-generator/pom.xml b/openhis-server-new/core-generator/pom.xml index 4d4c581f9..a1f0435bb 100755 --- a/openhis-server-new/core-generator/pom.xml +++ b/openhis-server-new/core-generator/pom.xml @@ -49,7 +49,8 @@ com.alibaba - druid-spring-boot-3-starter + druid + ${druid.version} diff --git a/openhis-server-new/core-quartz/pom.xml b/openhis-server-new/core-quartz/pom.xml index 4b5ee10df..fc8c5fce7 100755 --- a/openhis-server-new/core-quartz/pom.xml +++ b/openhis-server-new/core-quartz/pom.xml @@ -19,6 +19,11 @@ + + org.springframework.boot + spring-boot-starter-quartz + + org.quartz-scheduler quartz diff --git a/openhis-server-new/openhis-application/pom.xml b/openhis-server-new/openhis-application/pom.xml index ff9307701..a46427ea6 100755 --- a/openhis-server-new/openhis-application/pom.xml +++ b/openhis-server-new/openhis-application/pom.xml @@ -22,6 +22,16 @@ spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-flyway + + + org.springframework.boot + spring-boot-jdbc + + org.flywaydb @@ -79,12 +89,6 @@ org.apache.velocity velocity-engine-core - - - diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/OpenHisApplication.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/OpenHisApplication.java index d2fa15126..c53d5dff6 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/OpenHisApplication.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/OpenHisApplication.java @@ -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 1,2,3,4 - */ -@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(); diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/config/FlywayConfig.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/config/FlywayConfig.java index ca3620374..6a57c0203 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/config/FlywayConfig.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/config/FlywayConfig.java @@ -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; diff --git a/openhis-server-new/openhis-application/src/test/java/com/openhis/MedicationApplicationTests.java b/openhis-server-new/openhis-application/src/test/java/com/openhis/MedicationApplicationTests.java index af7e65371..4f97a9bd9 100755 --- a/openhis-server-new/openhis-application/src/test/java/com/openhis/MedicationApplicationTests.java +++ b/openhis-server-new/openhis-application/src/test/java/com/openhis/MedicationApplicationTests.java @@ -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; diff --git a/openhis-server-new/pom.xml b/openhis-server-new/pom.xml index 66bcdcbf5..bf8bc3020 100755 --- a/openhis-server-new/pom.xml +++ b/openhis-server-new/pom.xml @@ -7,7 +7,7 @@ org.springframework.boot spring-boot-starter-parent - 3.5.14 + 4.0.6 @@ -40,7 +40,7 @@ 1.18.34 3.5.16 7.1.0 - 42.7.4 + 42.7.10 5.3.3 4.5.14 2.0.61