π 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 Github.com 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 recently2.7.0
- Our runtime from
Java 8
toJava 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.
Find below the compatibility matrix (so you don't have to look for it π) :
π³ 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 :
ποΈ Java eclipse temurin:18.0.1_10-jre-alpine is out ! Now what ?
adriens for opt-nc γ» May 5 '22
π 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 application.properties
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