Migration to java 21
👣 Steps
Update parent pom.xml
Update Dockerfile
Update JVM_OPTIONS if you want to use ZGC
-XX:+UseZGC -XX:+ZGenerational
🐛 Issues encountered
✅ Fatal error compiling: error: invalid target release: 21
When compiling with Maven, I got the following error:
It's because I was using
mvnd
which was still using Java 17:
✅ java.lang.NoSuchFieldError
I need to upgrade Lombok. By bumping spring-boot to 3.1.5, it mitigates the issues:
✅ Unsupported class file major version 65
Upgrade Jacoco:
🚧 Mockito cannot mock this class: interface
assertj-core
in v3.24.2 is still using an old version of bytebuddy (v1.12.21) whereas it should have used 1.14.9
(version provided by Mockito). Available only on the next release of assertj v3.25.0.