Upgrade to SpringBoot 4 and Spring Framework 7#1165
Merged
Conversation
Owner
Author
|
No regression, no performace degrades after upgrading |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spring Framework 7 / Spring Boot 4 Upgrade Notes
This document tracks important information about the Spring Framework 7 / Spring Boot 4 upgrade performed on this project.
Upgrade Summary
Spring Cloud Alibaba
Status: Using stable release 2025.1.0.0 (available on Maven Central).
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.API Migration: javax.* to jakarta.*
Spring Framework 7 removes support for
javax.annotationandjavax.injectannotations. The following files were migrated fromjavax.annotation.Nullabletojakarta.annotation.Nullable:API Migration: DataSourceAutoConfiguration Package Change
In Spring Boot 4.0,
DataSourceAutoConfigurationmoved fromorg.springframework.boot.autoconfigure.jdbctoorg.springframework.boot.jdbc.autoconfigure. The following modules were updated (import +spring-boot-jdbcdependency):server/storage-jdbc-h2- H2StorageModuleAutoConfigurationserver/storage-jdbc-mysql- MySQLStorageModuleAutoConfigurationserver/storage-jdbc-postgresql- PostgresqlStorageModuleAutoConfigurationNote:
server/storage-jdbc-clickhousedoes not use@AutoConfigureBefore(DataSourceAutoConfiguration.class)and required no changes.API Migration: ServerProperties Package Change
In Spring Boot 4.0,
ServerPropertiesmoved fromorg.springframework.boot.autoconfigure.webtoorg.springframework.boot.web.server.autoconfigure. The following 13 files were updated:server/web-security/src/main/java/.../AsyncHttpRequestSecurityCustomizer.javaserver/web-security/src/main/java/.../SecurityAutoConfiguration.javaserver/alerting/evaluator/src/main/java/.../AlertEvaluator.javaserver/alerting/evaluator/src/main/java/.../EvaluatorModuleAutoConfiguration.javaserver/alerting/evaluator/src/test/java/.../AlertEvaluatorTest.javaserver/alerting/manager/src/main/java/.../AlertCommandService.javaserver/collector/src/main/java/.../ZipkinHttpTraceReceiverEnabler.javaserver/collector/src/main/java/.../JaegerHttpTraceReceiverEnabler.javaserver/collector/src/main/java/.../BithonHttpTraceEnabler.javaserver/collector/src/main/java/.../OtlpHttpTraceReceiverEnabler.javaserver/storage-jdbc/src/main/java/.../NotificationChannelJdbcStorage.javaserver/storage-jdbc-clickhouse/src/main/java/.../NotificationChannelStorage.javaserver/storage-jdbc-postgresql/src/main/java/.../NotificationChannelStorage.javaAPI Migration: jOOQ Auto-Configuration Package Change
In Spring Boot 4.0, jOOQ auto-configuration classes moved from
org.springframework.boot.autoconfigure.jooqtoorg.springframework.boot.jooq.autoconfigure. The following files were updated:server/storage-jdbc/src/main/java/.../JdbcStorageProviderConfiguration.javaserver/storage-jdbc-clickhouse/src/main/java/.../ClickHouseStorageProviderConfiguration.javaAPI Migration: javax.annotation.Nullable
server/web-service/src/main/java/org/bithon/server/web/service/datasource/api/impl/QueryFilter.javaserver/web-service/src/main/java/org/bithon/server/web/service/datasource/api/IntervalRequest.javaserver/web-service/src/main/java/org/bithon/server/web/service/datasource/api/QueryField.javaserver/web-service/src/main/java/org/bithon/server/web/service/datasource/api/GetDimensionRequest.javaserver/web-service/src/main/java/org/bithon/server/web/service/tracing/api/GetTraceByIdRequest.javaserver/web-service/src/main/java/org/bithon/server/web/service/meta/api/GetApplicationsRequest.javaserver/web-service/src/main/java/org/bithon/server/web/service/common/calcite/SqlExecutionEngine.javaserver/web-service/src/main/java/org/bithon/server/web/service/common/calcite/InformationSchema.javaserver/metric-expression/src/main/java/org/bithon/server/metric/expression/api/MetricQueryApi.javaserver/metric-expression/src/main/java/org/bithon/server/metric/expression/ast/MetricExpression.javaserver/pipeline/src/main/java/org/bithon/server/pipeline/metrics/SchemaMetricMessage.javaserver/pipeline/src/main/java/org/bithon/server/pipeline/common/transformer/TransformSpec.javaserver/alerting/evaluator/src/main/java/org/bithon/server/alerting/evaluator/evaluator/AlertEvaluator.javaserver/alerting/manager/src/main/java/org/bithon/server/alerting/manager/api/model/GetRuleFoldersRequest.javaserver/alerting/manager/src/main/java/org/bithon/server/alerting/manager/api/model/GetAlertRecordListRequest.javaNote: The
server/jOOQ/directory contains third-party vendored code and was intentionally NOT modified.Jackson 2 Configuration (Spring Boot 4)
Spring Boot 4 defaults to Jackson 3. To use Jackson 2 (for
Jackson2ObjectMapperBuilderand custom serializers):spring-boot-jackson2toserver-starter/pom.xmlspring.http.converters.preferred-json-mapper: jackson2inapplication.ymlNacos Configuration Loading (Spring Boot 4 / Spring Cloud Alibaba 2025)
Spring Cloud Alibaba 2025.x no longer loads Nacos configuration from the old bootstrap context.
The config client must be activated from
application.ymlusingspring.config.import.This project now loads:
optional:nacos:${spring.application.name}.yamlfromserver/server-starter/src/main/resources/application.ymloptional:nacos:${spring.application.name}-prod.yamlfrom a profile-activated document inserver/server-starter/src/main/resources/application.ymlIf another Spring profile is used, add another
spring.config.activate.on-profiledocument inapplication.ymlthat importsoptional:nacos:${spring.application.name}-<profile>.yaml.Jackson 3 Migration (Future)
Migrating from Jackson 2 to Jackson 3 is a significant effort due to breaking API changes. Key changes required:
Package Changes
com.fasterxml.jackson.core→tools.jackson.corecom.fasterxml.jackson.databind→tools.jackson.databindcom.fasterxml.jackson.dataformat→tools.jackson.dataformatcom.fasterxml.jackson.annotation→ unchanged (backward compatible)API Renames
JsonSerializerValueSerializer(extendStdSerializer)JsonDeserializerValueDeserializer(extendStdDeserializer)SerializerProviderSerializationContextBeanDeserializerModifierValueDeserializerModifierJsonProcessingExceptionJacksonException(unchecked)JsonParser.Feature.ALLOW_COMMENTSJsonReadFeature.ALLOW_JAVA_COMMENTSConfiguration Changes
Jackson2ObjectMapperBuilderwithJsonMapper.builder()@Bean ObjectMapperwith@Bean JsonMapper(JsonMapper extends ObjectMapper)ObjectMapperis immutable in Jackson 3; use builder patternDependencies
spring-boot-jackson2; use defaultspring-boot-jacksoncom.fasterxml.jackson.*totools.jackson.*in pom.xml (Spring Boot 4 BOM manages versions)jOOQ Jackson 3 Support (Prerequisite)
server/jOOQ/withjOOQ-jackson-extensions(Jackson 2 only)org.jooq.jackson3.extensions.converters.JSONtoJacksonConverter,JSONBtoJacksonConverterMigration path: Upgrade the vendored jOOQ fork to 3.21+ when released, then switch to Jackson 3 converters. Alternatively, migrate to official
jooq-jackson-extensionsfrom Maven Central and wait for 3.21.jjwt-jackson Module
jjwt-jackson0.11.5 inserver/web-security/pom.xmlfor JWT serializationcom.fasterxml.jackson.core:jackson-databind:2.20.1(transitive)spring-boot-jackson2, Jackson 2 is primary; jjwt-jackson fits without conflictJavaTypeincompatibility in convertersAlternatives if jjwt-jackson blocks migration: Use
jjwt-gsonorjjwt-orgjsoninstead ofjjwt-jacksonto avoid Jackson dependency; requires swapping the serializer/deserializer implementation.Tools
org.openrewrite.java.jackson.UpgradeJackson_2_3_PackageChangesfor import updatesKnown Issues and Considerations
Spring Cloud Alibaba Compatibility: Using stable 2025.1.0.0 release from Maven Central.
jOOQ Library: The vendored jOOQ library in
server/jOOQ/still containsjavax.*imports. This is third-party code and should not be modified. It should work as long as the jOOQ library itself maintains backward compatibility.Druid Spring Boot Starter: Version 1.2.27 is used. Verify compatibility with Spring Boot 4.0.x during testing.
References
Last Updated: February 2026