Skip to content

Upgrade to Java 21 and Spring Boot 3.2.12#201

Open
ninhomilton wants to merge 12 commits intomainfrom
UpgradeJava21
Open

Upgrade to Java 21 and Spring Boot 3.2.12#201
ninhomilton wants to merge 12 commits intomainfrom
UpgradeJava21

Conversation

@ninhomilton
Copy link
Copy Markdown
Collaborator

Upgrade to Java 21 and Spring Boot 3.2.12

  • Upgrades the entire project from Java 11 to Java 21 and Spring Boot 2.x to 3.2.12 across all 7 modules
  • Updates GitHub Actions workflows (build.yml, main.yml, release.yml) to use java-version: 21
  • Fixes test compatibility issues: truncates LocalDateTime to microseconds in repository tests to match MySQL precision
  • Migrates Spring/Hibernate imports and configs for Spring Boot 3 compatibility (e.g. MySQLDialect, JPA config updates)
  • Upgrades spotbugs-maven-plugin to 4.8.6.6 and other dependencies for Java 21 compatibility

ninhomilton and others added 11 commits March 18, 2026 17:18
- Bump Java source/target/release to 21 across all modules
- Upgrade Spring Boot from 2.7.9 to 3.2.12
- Migrate javax.* to jakarta.* (persistence, servlet, annotation)
- Add CrudRepository to repository interfaces (Spring Data 3.x breaking change)
- Update springdoc-openapi from 1.x to 2.x (GroupedOpenApi, ParameterObject)
- Fix Testcontainers LocalStack API: getEndpointOverride() replaces getEndpointConfiguration()
- Fix Awaitility 4.x: replace org.awaitility.Duration with java.time.Duration
- Fix Hadoop+Java21: disable FileSystem cache to avoid UserGroupInformation incompatibility
- Add JVM --add-opens flags for Hadoop/reflection compatibility in tests
- Exclude JPA auto-configuration from @WebMvcTest context in API tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace JUnit 4 @rule with @container on LocalStack S3 containers in
  BeekeeperMetadataCleanupIntegrationTest and BeekeeperDryRunMetadataCleanupIntegrationTest
  to fix ExceptionInInitializerError caused by static block running before Testcontainers start
- Add properties.sqs.endpoint and properties.sqs.region Spring properties to
  CommonBeans.messageReader() so the SqsMessageReader uses a custom AmazonSQS client
  with explicit LocalStack endpoint and matching region (us-west-2), fixing
  QueueDoesNotExistException caused by LocalStack's region-sensitive SQS queue lookup
- Set properties.sqs.region in BeekeeperUnreferencedPathSchedulerApiaryIntegrationTest
  and BeekeeperExpiredMetadataSchedulerApiaryIntegrationTest to match the region used
  when creating SQS queues in LocalStack
- Apply Spotless formatting to all changed integration test files

All 71 integration tests now pass (1 skipped, pre-existing).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- PagingMetadataCleanupServiceTest: fix ArgumentCaptor type from
  HousekeepingPath to HousekeepingEntity to match the actual type
  passed to PathCleaner.cleanupPath(HousekeepingEntity)
- CommonBeans (path-cleanup): remove spurious withPathStyleAccessEnabled(true)
  from amazonS3Test() which caused URL host to be "endpoint" instead of
  "bucket.endpoint" as the test expected

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
After Java 21 / Spring Boot 3.2.12 upgrade, LocalDateTime.now() produces
nanosecond-precision timestamps but H2 (MySQL mode) stores DATETIME with
microsecond precision, causing round-trip comparison failures and incorrect
query boundary evaluations. Truncate CREATION_TIMESTAMP and compare() helper
to MICROS to align in-memory values with DB-stored values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… test

Same nanosecond vs microsecond precision issue as in beekeeper-core tests.
H2 (MySQL mode) truncates DATETIME to microseconds, causing the cleanupTimestamp
round-trip comparison to fail after Java 21 upgrade.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SpotBugs 4.0.4 (inherited from eg-oss-parent) uses an outdated ASM library
that cannot parse Java 21 class files (major version 65), causing the CI
build to fail with NoClassesFoundToAnalyzeException. Overriding
maven.spotbugs.plugin.version to 4.8.6.6 resolves the issue.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@jamespfaulkner jamespfaulkner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there something preventing us from going to the latest spring boot 3.5.x?

Comment thread pom.xml Outdated
Comment on lines +190 to +192
<source>21</source>
<target>21</target>
<release>21</release>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can probably just use the jdk.version property here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment thread pom.xml
Comment on lines +241 to +243
<source>21</source>
<target>21</target>
<release>21</release>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same jdk.version property

with:
distribution: 'adopt'
java-version: '11'
distribution: 'corretto'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor question. Is there a reason we use corretto here but temurin as the base image?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AdoptOpenJDK (adopt) no longer distributes Java 21. AdoptOpenJDK stopped releasing new JDK versions after JDK 17.

Comment thread pom.xml Outdated
<jackson.version>2.17.2</jackson.version>
<snakeyaml.version>2.2</snakeyaml.version>
<springframework.boot.version>3.2.12</springframework.boot.version>
<springframework.version>6.1.15</springframework.version>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used now we've removed the direct springframework dependencies from the pom?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove that line as it is not needed anymore

Remove hardcoded '21' from maven.compiler.source/target/release, docker.from.tag,
and both maven-compiler-plugin configurations, replacing them with ${jdk.version}.
Also remove unused springframework.version property now that direct Spring
dependencies are managed by the spring-boot-dependencies BOM.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants