DEV Community

Cover image for 🏁 Preparing for Spring Boot 3.0
adriens for opt-nc

Posted on

🏁 Preparing for Spring Boot 3.0

👉 Context

We all are aware that...

Spring Boot 3.0 is coming ❕

Since a few months as part of our pipeline's migration from onPremise to process we have been prototyping on Spring Native and invest on maintenance by upgrading :

  • Our dependencies (let Dependabot PRs ⛆ 😱 ), making us upgrade all to 2.6.7, then more recently 2.7.0
  • Our runtime from Java 8 to Java 17... from the dev side up to the server runtime

🧽 Gains

That was a big work to achieve but offered us the opportunity to improve our testing strategies (less code for more coverage), dependencies cleanup/removal to make native easier in a near future.

Notice that this investment made it possible to achieve RUN tasks in a much more comfortable on a continuous pace and less time consuming way... while making it possible to upgrade the middlewares we rely on.

☝️ Switching to Spring Data libraries

As part of dependencies cleanup, we switched to Spring Data for Elasticsearch, hence making us rely on Spring Data instead of Elastic's ones.

So we chose the following straightforward strategy :

We did migrate our Elastic instance to Elastic 7... and wait to Spring Boot 3, based on Spring 6 and Java 17.

Image description

Find below the compatibility matrix (so you don't have to look for it 😓) :

Image description

🐳 Docker prepare

In the mean time we also did prepare traditional (non native) docker images that embeds a secured Java 17 runtime, see below for more :

🌌 Be ready for Spring Boot 3

Fortunately Spring tweeted a dedicated post on this topic :

According to the blog post, here are the things you can do to get ready.

In our team, this will be used as a checklist to get ready to migrate as clean as possible :

1️⃣ Upgrade to Java 17

"Spring Boot 3.0 will require Java 17."

Hence it makes it possible to use Records.

Also here is Spring advice :

"We highly recommend that you upgrade your JDK today if at all possible."

2️⃣ Upgrade to the Latest Spring Boot 2.7.x

Spring will provide a migration guide to Spring Boot 3...

"but it will assume that you’re migrating from Spring Boot 2.7 and not an earlier version."

We also applied the following migration strategy, following SB upgrades on a continuous way (so we finally could drastically reduce our technical debt):

If you’re upgrading from Spring Boot 2.5 or earlier, we don’t recommend skipping releases.** It’s often easier to upgrade in steps** (e.g. 2.5 → 2.6 → 2.7) rather than trying to upgrade directly from 2.5 → 2.7.

3️⃣ Check for Calls to Deprecated Code

Spring Boot 3.0 will remove all deprecated code, so we recommend that you check your existing code is not relying on any deprecated methods. It’s worth considering using the -Werror Java compiler option to fail your build if deprecation warnings are reported.

4️⃣ Migrate from Legacy and application.yaml Processing

The legacy processing support will not be coming to Spring Boot 3.0 so you should check that your project doesn’t set spring.config.use-legacy-processing.

5️⃣ Use Spring MVC’s PathPatternParser

we recommend using the PathPatternParser if at all possible since it provides better performance.

6️⃣ Other

Also see the full blog post for more about Third-party Projects Have Jakarta EE 9 Compatible Releases and Third-party Projects have Updated Spring Compatible Releases

🔖 Resources

Top comments (4)

adriens profile image
adriens profile image
adriens profile image
adriens profile image

Another great news !