Skip to end of banner
Go to start of banner

Migration to Java 21 and Spring Boot 3.4

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 18 Next »

Please add any missing hints to this document!

See TC’s Officially Supported Technologies / Sunflower decision document.

Jenkinsfile

In Jenkinsfile change the buildNode from java17 to java21:

buildNode = 'jenkins-agent-java21' 

Dockerfile

In Dockerfile change the container from opendjk17 to openjdk21:

FROM folioci/alpine-jre-openjdk21:latest

GitHub Actions

A few projects use a Java in GitHub Actions workflow, check the .github/workflows directory. Upgrade java-version from 17 to 21:

- uses: actions/setup-java@v4
  with:
    distribution: 'temurin'
    java-version: '21'

POM Files

If declared, be sure to change the Java version and source/target compilation versions.   This can be done under the main properties block:

<java.version>21</java.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>

Note: for this to work, be sure that the source/target versions are not overridden in the maven-compiler-plugin configuration.

Spring Boot

Upgrade the spring-boot-starter-parent version to the latest 3.4 version, find the version on https://github.com/spring-projects/spring-boot/tags

This is a milestone version like 3.4.0-M4 or a release candidate version like 3.4.0-RC5 because a final version is not available yet.

Add

    <repository>
      <id>repo.spring.io-milestone</id>
      <url>https://repo.spring.io/milestone</url>
    </repository>
    <repository>
      <id>repo.spring.io-snapshot</id>
      <url>https://repo.spring.io/snapshot</url>
    </repository>

to the <repositories> section of pom.xml.

Add

  <pluginRepositories>
    <pluginRepository>
      <id>spring-milestones</id>
      <url>https://repo.spring.io/milestone</url>
    </pluginRepository>
  </pluginRepositories>

to pom.xml for spring-boot-maven-plugin.

Replace javax.annotation.PostConstruct with jakarta.annotation.PostConstruct.

Add null argument to buildConsumerProperties() and buildProducerProperties() of KafkaProperties (example).

Migrated repositories

Some FOLIO modules and FOLIO libraries have been migrated to Spring Boot 3.4 to demonstrate that only small changes are needed:

Why milestone and release candidate versions?

Some FOLIO development teams start Sunflower work before the official Spring Boot 3.4.0 version gets released:

Spring Branch

Initial Release

End of Support

Spring Boot 3.4.x

2024-11-21

2025-11-21

Why snapshot versions?

For spring-cloud-starter-openfeign.

spring-cloud-starter-openfeign is a dependency of folio-spring-base, folio-spring-system-user and most spring based modules. spring-cloud-starter-openfeign 4.2.x is required for Spring Boot 3.4.x, and spring-cloud-starter-openfeign hasn’t published milestone or release candidate versions yet, only 3.4.0-SNAPSHOT versions: https://github.com/spring-cloud/spring-cloud-openfeign/tags

This is low risk because Spring Cloud OpenFeign project is treated as feature-complete.

When upgrade to release versions?

After Spring Boot 3.4.0 has been released and before the module gets released.

What is Spring Boot’s milestone and release candidate history?

v3.3.x:

v3.2.x:

v3.1.x:

Spring Boot has always been released on the planned date.

Difference between RC and GA

Is there a risk that the devs on the spring project change their minds and some things in the 3.4 RC don't make it into 3.4 GA?

No, RC is feature freeze.

Even if a feature from RC gets removed in GA, most FOLIO modules won’t be affected because usually they don’t use features from the latest minor version.

  • No labels