|
| 1 | +# Spring Framework 7 / Spring Boot 4 Upgrade Notes |
| 2 | + |
| 3 | +This document tracks important information about the Spring Framework 7 / Spring Boot 4 upgrade performed on this project. |
| 4 | + |
| 5 | +## Upgrade Summary |
| 6 | + |
| 7 | +| Component | Previous Version | Current Version | |
| 8 | +|-----------|-----------------|-----------------| |
| 9 | +| Spring Boot | 3.3.1 | 4.0.0 | |
| 10 | +| Spring Cloud | 2023.0.2 | 2025.1.0 | |
| 11 | +| Spring Cloud Alibaba | 2023.0.1.0 | 2025.1.0.0 | |
| 12 | +| Hibernate Validator | 8.0.1.Final | 9.0.0.Final | |
| 13 | +| Java Baseline | 17 | 17 (unchanged) | |
| 14 | + |
| 15 | +## Spring Cloud Alibaba |
| 16 | + |
| 17 | +**Status**: Using stable release 2025.1.0.0 (available on Maven Central). |
| 18 | + |
| 19 | +The project uses `spring-cloud-alibaba-dependencies:2025.1.0.0`, which supports Spring Boot 4.0.x and Spring Cloud 2025.1.x. No GitHub Packages repository or authentication is required. |
| 20 | + |
| 21 | +## API Migration: javax.* to jakarta.* |
| 22 | + |
| 23 | +Spring Framework 7 removes support for `javax.annotation` and `javax.inject` annotations. The following files were migrated from `javax.annotation.Nullable` to `jakarta.annotation.Nullable`: |
| 24 | + |
| 25 | +## API Migration: DataSourceAutoConfiguration Package Change |
| 26 | + |
| 27 | +In Spring Boot 4.0, `DataSourceAutoConfiguration` moved from `org.springframework.boot.autoconfigure.jdbc` to `org.springframework.boot.jdbc.autoconfigure`. The following modules were updated (import + `spring-boot-jdbc` dependency): |
| 28 | + |
| 29 | +- `server/storage-jdbc-h2` - H2StorageModuleAutoConfiguration |
| 30 | +- `server/storage-jdbc-mysql` - MySQLStorageModuleAutoConfiguration |
| 31 | +- `server/storage-jdbc-postgresql` - PostgresqlStorageModuleAutoConfiguration |
| 32 | + |
| 33 | +Note: `server/storage-jdbc-clickhouse` does not use `@AutoConfigureBefore(DataSourceAutoConfiguration.class)` and required no changes. |
| 34 | + |
| 35 | +## API Migration: ServerProperties Package Change |
| 36 | + |
| 37 | +In Spring Boot 4.0, `ServerProperties` moved from `org.springframework.boot.autoconfigure.web` to `org.springframework.boot.web.server.autoconfigure`. The following 13 files were updated: |
| 38 | + |
| 39 | +- `server/web-security/src/main/java/.../AsyncHttpRequestSecurityCustomizer.java` |
| 40 | +- `server/web-security/src/main/java/.../SecurityAutoConfiguration.java` |
| 41 | +- `server/alerting/evaluator/src/main/java/.../AlertEvaluator.java` |
| 42 | +- `server/alerting/evaluator/src/main/java/.../EvaluatorModuleAutoConfiguration.java` |
| 43 | +- `server/alerting/evaluator/src/test/java/.../AlertEvaluatorTest.java` |
| 44 | +- `server/alerting/manager/src/main/java/.../AlertCommandService.java` |
| 45 | +- `server/collector/src/main/java/.../ZipkinHttpTraceReceiverEnabler.java` |
| 46 | +- `server/collector/src/main/java/.../JaegerHttpTraceReceiverEnabler.java` |
| 47 | +- `server/collector/src/main/java/.../BithonHttpTraceEnabler.java` |
| 48 | +- `server/collector/src/main/java/.../OtlpHttpTraceReceiverEnabler.java` |
| 49 | +- `server/storage-jdbc/src/main/java/.../NotificationChannelJdbcStorage.java` |
| 50 | +- `server/storage-jdbc-clickhouse/src/main/java/.../NotificationChannelStorage.java` |
| 51 | +- `server/storage-jdbc-postgresql/src/main/java/.../NotificationChannelStorage.java` |
| 52 | + |
| 53 | +## API Migration: jOOQ Auto-Configuration Package Change |
| 54 | + |
| 55 | +In Spring Boot 4.0, jOOQ auto-configuration classes moved from `org.springframework.boot.autoconfigure.jooq` to `org.springframework.boot.jooq.autoconfigure`. The following files were updated: |
| 56 | + |
| 57 | +- `server/storage-jdbc/src/main/java/.../JdbcStorageProviderConfiguration.java` |
| 58 | +- `server/storage-jdbc-clickhouse/src/main/java/.../ClickHouseStorageProviderConfiguration.java` |
| 59 | + |
| 60 | +## API Migration: javax.annotation.Nullable |
| 61 | + |
| 62 | +- `server/web-service/src/main/java/org/bithon/server/web/service/datasource/api/impl/QueryFilter.java` |
| 63 | +- `server/web-service/src/main/java/org/bithon/server/web/service/datasource/api/IntervalRequest.java` |
| 64 | +- `server/web-service/src/main/java/org/bithon/server/web/service/datasource/api/QueryField.java` |
| 65 | +- `server/web-service/src/main/java/org/bithon/server/web/service/datasource/api/GetDimensionRequest.java` |
| 66 | +- `server/web-service/src/main/java/org/bithon/server/web/service/tracing/api/GetTraceByIdRequest.java` |
| 67 | +- `server/web-service/src/main/java/org/bithon/server/web/service/meta/api/GetApplicationsRequest.java` |
| 68 | +- `server/web-service/src/main/java/org/bithon/server/web/service/common/calcite/SqlExecutionEngine.java` |
| 69 | +- `server/web-service/src/main/java/org/bithon/server/web/service/common/calcite/InformationSchema.java` |
| 70 | +- `server/metric-expression/src/main/java/org/bithon/server/metric/expression/api/MetricQueryApi.java` |
| 71 | +- `server/metric-expression/src/main/java/org/bithon/server/metric/expression/ast/MetricExpression.java` |
| 72 | +- `server/pipeline/src/main/java/org/bithon/server/pipeline/metrics/SchemaMetricMessage.java` |
| 73 | +- `server/pipeline/src/main/java/org/bithon/server/pipeline/common/transformer/TransformSpec.java` |
| 74 | +- `server/alerting/evaluator/src/main/java/org/bithon/server/alerting/evaluator/evaluator/AlertEvaluator.java` |
| 75 | +- `server/alerting/manager/src/main/java/org/bithon/server/alerting/manager/api/model/GetRuleFoldersRequest.java` |
| 76 | +- `server/alerting/manager/src/main/java/org/bithon/server/alerting/manager/api/model/GetAlertRecordListRequest.java` |
| 77 | + |
| 78 | +**Note**: The `server/jOOQ/` directory contains third-party vendored code and was intentionally NOT modified. |
| 79 | + |
| 80 | +## Jackson 2 Configuration (Spring Boot 4) |
| 81 | + |
| 82 | +Spring Boot 4 defaults to Jackson 3. To use Jackson 2 (for `Jackson2ObjectMapperBuilder` and custom serializers): |
| 83 | + |
| 84 | +1. **Dependency**: Add `spring-boot-jackson2` to `server-starter/pom.xml` |
| 85 | +2. **Configuration**: Set `spring.http.converters.preferred-json-mapper: jackson2` in `application.yml` |
| 86 | + |
| 87 | +## Nacos Configuration Loading (Spring Boot 4 / Spring Cloud Alibaba 2025) |
| 88 | + |
| 89 | +Spring Cloud Alibaba 2025.x no longer loads Nacos configuration from the old bootstrap context. |
| 90 | +The config client must be activated from `application.yml` using `spring.config.import`. |
| 91 | + |
| 92 | +This project now loads: |
| 93 | + |
| 94 | +1. `optional:nacos:${spring.application.name}.yaml` from `server/server-starter/src/main/resources/application.yml` |
| 95 | +2. `optional:nacos:${spring.application.name}-prod.yaml` from a profile-activated document in `server/server-starter/src/main/resources/application.yml` |
| 96 | + |
| 97 | +If another Spring profile is used, add another `spring.config.activate.on-profile` document in |
| 98 | +`application.yml` that imports `optional:nacos:${spring.application.name}-<profile>.yaml`. |
| 99 | + |
| 100 | +## Jackson 3 Migration (Future) |
| 101 | + |
| 102 | +Migrating from Jackson 2 to Jackson 3 is a significant effort due to breaking API changes. Key changes required: |
| 103 | + |
| 104 | +### Package Changes |
| 105 | +- `com.fasterxml.jackson.core` → `tools.jackson.core` |
| 106 | +- `com.fasterxml.jackson.databind` → `tools.jackson.databind` |
| 107 | +- `com.fasterxml.jackson.dataformat` → `tools.jackson.dataformat` |
| 108 | +- `com.fasterxml.jackson.annotation` → **unchanged** (backward compatible) |
| 109 | + |
| 110 | +### API Renames |
| 111 | +| Jackson 2 | Jackson 3 | |
| 112 | +|-----------|-----------| |
| 113 | +| `JsonSerializer` | `ValueSerializer` (extend `StdSerializer`) | |
| 114 | +| `JsonDeserializer` | `ValueDeserializer` (extend `StdDeserializer`) | |
| 115 | +| `SerializerProvider` | `SerializationContext` | |
| 116 | +| `BeanDeserializerModifier` | `ValueDeserializerModifier` | |
| 117 | +| `JsonProcessingException` | `JacksonException` (unchecked) | |
| 118 | +| `JsonParser.Feature.ALLOW_COMMENTS` | `JsonReadFeature.ALLOW_JAVA_COMMENTS` | |
| 119 | + |
| 120 | +### Configuration Changes |
| 121 | +- Replace `Jackson2ObjectMapperBuilder` with `JsonMapper.builder()` |
| 122 | +- Replace `@Bean ObjectMapper` with `@Bean JsonMapper` (JsonMapper extends ObjectMapper) |
| 123 | +- `ObjectMapper` is immutable in Jackson 3; use builder pattern |
| 124 | + |
| 125 | +### Dependencies |
| 126 | +- Remove `spring-boot-jackson2`; use default `spring-boot-jackson` |
| 127 | +- Change `com.fasterxml.jackson.*` to `tools.jackson.*` in pom.xml (Spring Boot 4 BOM manages versions) |
| 128 | +- **jjwt-jackson**: Uses Jackson 2; see [jjwt-jackson details](#jjwt-jackson-module) below |
| 129 | + |
| 130 | +### jOOQ Jackson 3 Support (Prerequisite) |
| 131 | + |
| 132 | +| Aspect | Details | |
| 133 | +|--------|---------| |
| 134 | +| **Current Bithon jOOQ** | Vendored fork at **3.17.99** in `server/jOOQ/` with `jOOQ-jackson-extensions` (Jackson 2 only) | |
| 135 | +| **Jackson 3 support** | Introduced in **jOOQ 3.21** (Dev, TBA as of Feb 2026) | |
| 136 | +| **Jackson 3 converters** | `org.jooq.jackson3.extensions.converters.JSONtoJacksonConverter`, `JSONBtoJacksonConverter` | |
| 137 | +| **Latest stable jOOQ** | 3.20.11 (Jan 2026) — still Jackson 2 only | |
| 138 | +| **jOOQ 3.20 JDK baseline** | Open Source Edition requires JDK 21; Bithon uses Java 17 | |
| 139 | + |
| 140 | +**Migration path**: Upgrade the vendored jOOQ fork to 3.21+ when released, then switch to Jackson 3 converters. Alternatively, migrate to official `jooq-jackson-extensions` from Maven Central and wait for 3.21. |
| 141 | + |
| 142 | +### jjwt-jackson Module |
| 143 | + |
| 144 | +| Aspect | Details | |
| 145 | +|--------|---------| |
| 146 | +| **Bithon usage** | `jjwt-jackson` 0.11.5 in `server/web-security/pom.xml` for JWT serialization | |
| 147 | +| **Jackson dependency** | `com.fasterxml.jackson.core:jackson-databind:2.20.1` (transitive) | |
| 148 | +| **Jackson 3 support** | **None** as of Feb 2026. Upstream issues [#1029](https://github.com/jwtk/jjwt/issues/1029), [#1032](https://github.com/jwtk/jjwt/issues/1032), [#1038](https://github.com/jwtk/jjwt/issues/1038) track Jackson 3 support; PRs in progress, not yet merged | |
| 149 | +| **Current Bithon setup** | With `spring-boot-jackson2`, Jackson 2 is primary; jjwt-jackson fits without conflict | |
| 150 | +| **Jackson 3 migration impact** | jjwt-jackson would become a blocker. Users report "split brain" when mixing Jackson 2 (jjwt) and Jackson 3 (Spring Boot 4 default): separate config, different defaults, `JavaType` incompatibility in converters | |
| 151 | + |
| 152 | +**Alternatives if jjwt-jackson blocks migration**: Use `jjwt-gson` or `jjwt-orgjson` instead of `jjwt-jackson` to avoid Jackson dependency; requires swapping the serializer/deserializer implementation. |
| 153 | + |
| 154 | +### Tools |
| 155 | +- [OpenRewrite recipe](https://docs.openrewrite.org/recipes/java/jackson/upgradejackson_2_3_packagechanges): `org.openrewrite.java.jackson.UpgradeJackson_2_3_PackageChanges` for import updates |
| 156 | +- [Jackson 3 Migration Guide](https://github.com/FasterXML/jackson/blob/main/jackson3/MIGRATING_TO_JACKSON_3.md) |
| 157 | +- [jOOQ Jackson converters](https://www.jooq.org/doc/latest/manual/code-generation/codegen-advanced/codegen-config-database/codegen-database-forced-types/codegen-database-forced-types-jackson-converter/) |
| 158 | + |
| 159 | +## Known Issues and Considerations |
| 160 | + |
| 161 | +1. **Spring Cloud Alibaba Compatibility**: Using stable 2025.1.0.0 release from Maven Central. |
| 162 | + |
| 163 | +2. **jOOQ Library**: The vendored jOOQ library in `server/jOOQ/` still contains `javax.*` imports. This is third-party code and should not be modified. It should work as long as the jOOQ library itself maintains backward compatibility. |
| 164 | + |
| 165 | +3. **Druid Spring Boot Starter**: Version 1.2.27 is used. Verify compatibility with Spring Boot 4.0.x during testing. |
| 166 | + |
| 167 | +## References |
| 168 | + |
| 169 | +- [JJWT Jackson 3 Support (GitHub #1029)](https://github.com/jwtk/jjwt/issues/1029) |
| 170 | +- [Spring Framework 7.0 Release Notes](https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-7.0-Release-Notes) |
| 171 | +- [Spring Boot 4.0 Release Notes](https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Release-Notes) |
| 172 | +- [Spring Cloud Alibaba GitHub](https://github.com/alibaba/spring-cloud-alibaba) |
| 173 | + |
| 174 | +--- |
| 175 | + |
| 176 | +*Last Updated: February 2026* |
0 commit comments