Scrivio Interview library
ScenarioFoundations7 min read · updated 12 November 2026

You are upgrading a Spring Boot service from Java 17 to Java 25. What steps do you follow and what problems might you hit?

First I check that the Spring Boot version and the key libraries, especially bytecode tools, mocking libraries and Java agents, support Java 25. Then I update the build toolchain, the CI images and the runtime base image, run the full test suite looking for removed APIs, strong encapsulation errors and changed defaults, read the release notes for behaviour changes such as the Security Manager no longer being available (JEP 486, JDK 24), and deploy to a canary before rolling out.

Why this question is asked

Java 25 is the current long-term support release, and moving from 17 to 25 skips eight feature releases at once. Most Spring Boot services upgrade with little code change, but the failures that do happen tend to come from places we do not look at every day: a Java agent, a mocking library, a default that changed silently. Interviewers ask this to see whether a candidate has a careful, ordered process rather than just changing a number in the build file. In this answer, we will check compatibility first, update the toolchain and images, look at the problems the test suite usually finds, go through behaviour changes between 17 and 25, and finish with a canary rollout.

1A Quick Recap of What Changes Between Java 17 and 25

Each Java release can remove deprecated APIs, change defaults and tighten rules. Between 17 and 25, the changes most likely to affect a service are: UTF-8 became the default charset (JDK 18), the Security Manager was permanently disabled (JDK 24), warnings were added for dynamically loading agents (JDK 21) and for using sun.misc.Unsafe memory methods (JDK 24), annotation processing is no longer run automatically by javac (JDK 23), and virtual threads arrived (JDK 21).

Class files also carry a version number. Java 25 produces version 69 class files, and any tool that reads or writes bytecode, such as Byte Buddy, ASM, JaCoCo or a Java agent, must understand that version. This is why libraries that manipulate bytecode are the first thing to check.

2Checking Framework and Library Support

We start with Spring Boot. Java 25 is supported by recent Spring Boot 3.5 patch releases and by Spring Boot 4.0; check the release notes of your exact version. If the service is on an older Boot line, we upgrade Boot first, on Java 17, and release that separately. The reason is that changing two big things at once makes any failure hard to explain.

Then we look at the libraries that work with bytecode or the JVM internals: Mockito and Byte Buddy, Lombok, JaCoCo, any APM or profiling agent such as an OpenTelemetry Java agent, and code generators like MapStruct. Each needs a release that supports Java 25. Running mvn dependency:tree or gradle dependencies shows where old versions come from, often pinned in a parent build or a company BOM.

3Updating the Toolchain and Images

Three places define the Java version, and all three must move together: the build, the CI image and the runtime image. A mismatch causes confusing errors, such as an UnsupportedClassVersionError when code compiled for 25 runs on a 17 image.

XML
<!-- Maven, with the Spring Boot parent -->
<properties>
<java.version>25</java.version> <!-- sets maven.compiler.release to 25 -->
</properties>
// Gradle
java {
toolchain { languageVersion = JavaLanguageVersion.of(25) } // Gradle downloads or finds a JDK 25
}
# Dockerfile runtime image
FROM eclipse-temurin:25-jre # was eclipse-temurin:17-jre

Notice that the Maven and Gradle versions themselves must also be recent enough to run with or compile for Java 25, and so must plugins such as the Maven Surefire and compiler plugins. If the CI build runs on a shared image, we update that image or use toolchains so the build does not depend on whatever JDK the image happens to have.

4Running the Tests and Reading the Failures

Now we run the whole test suite on Java 25. The common failures fall into a few groups. The first is strong encapsulation: since JDK 17, internal JDK packages are closed to reflection, so a library calling setAccessible on a private JDK field throws InaccessibleObjectException. Coming from 17, we usually saw these already, but an old library version may still hide one. The fix is a newer library, and only as a last resort an --add-opens flag that we document and plan to remove.

The second group is removed or restricted APIs, such as code that still calls System.setSecurityManager or Thread.stop. The third is tooling: if a build relied on javac finding annotation processors on the class path, JDK 23 and later no longer run them automatically, and generated classes from Lombok or MapStruct go missing until we declare them in annotationProcessorPaths or pass -proc:full.

Java
# Mockito's inline mock maker attaches an agent at runtime, and JDK 21+ warns:
# WARNING: A Java agent has been loaded dynamically ...
<!-- Fix in Maven: load Mockito as an agent at startup -->
<!-- (the dependency:properties goal defines the jar path property) -->
<argLine>-javaagent:${org.mockito:mockito-core:jar}</argLine>

The Mockito warning is harmless today, but a future JDK may refuse dynamic agent loading by default, so it is better to configure the agent now.

5Checking Behaviour Changes

Some changes do not fail tests but change behaviour. The default charset became UTF-8 in JDK 18, so a service that read files or bytes without naming a charset on a server whose locale was not UTF-8 will now decode them differently. The Security Manager can no longer be enabled since JDK 24 (JEP 486), so any code or library relying on it must change. Locale data from the old COMPAT provider was removed in JDK 23, which can change some date and number formats.

We also read the release notes for garbage collection and memory. The default collector is still G1, but its tuning has improved, and container memory detection affects default heap size. ZGC is now generational only. Rather than guess, we compare the GC logs and memory use of the old and new versions in the next step.

Changes worth checking when moving from 17 to 25
ChangeReleaseWhat to look for
UTF-8 default charsetJDK 18Code reading bytes without naming a charset
Dynamic agent warningsJDK 21Mockito and attaching profilers
Annotation processing not automaticJDK 23Missing Lombok or MapStruct classes
COMPAT locale data removedJDK 23Changed date or number formatting
Security Manager cannot be enabledJDK 24Code calling setSecurityManager
Unsafe memory access warningsJDK 24Old serialization or buffer libraries

6Rolling Out With a Canary

A canary is a small share of production traffic sent to the new version while the rest stays on the old one. We deploy one Java 25 instance next to the Java 17 instances and compare latency percentiles, error rates, heap and native memory, GC pauses and CPU over at least a full day of traffic, so daily peaks are included.

If the numbers are equal or better, we increase the share step by step. If something is worse, the canary limits the damage to a few percent of requests and we roll back by redeploying the old image. Only after the rollout is complete do we start using new language features, so a rollback never requires reverting code.

7Follow-up questions

Should we turn on virtual threads as part of the upgrade?

Not in the same change. Virtual threads are a separate improvement with their own risks, such as connection pools sized for the old thread count. I would complete the Java 25 upgrade, let it run, and then enable spring.threads.virtual.enabled in its own release with its own measurements.

What if a key library has no Java 25 release yet?

I would check whether the library works anyway, since many do if they do not touch bytecode, by running the tests. If it does not, I look for a newer fork or a replacement, or delay the service's upgrade while still upgrading the rest. Adding --add-opens flags is acceptable only as a documented temporary fix.

Why upgrade Spring Boot separately from Java?

Because each change can cause failures, and when both happen at once we cannot tell which one caused a problem. Upgrading Boot first on Java 17, releasing it, and then changing the JDK keeps each step small and easy to roll back.

8Conclusion

In this answer, we followed an upgrade from Java 17 to 25 for a Spring Boot service. We checked that Spring Boot and the bytecode-heavy libraries support Java 25, updated the build toolchain, CI image and runtime image together, and ran the tests looking for encapsulation errors, removed APIs and tooling changes such as annotation processing. We reviewed behaviour changes like the UTF-8 default and the Security Manager removal in JDK 24, and rolled out through a canary, comparing latency, memory and errors.

What to say in the interviewAbout 80 seconds aloud

Open with

I would start by checking compatibility, because most problems come from libraries rather than our own code. That means a Spring Boot version that supports Java 25, which is a recent 3.5 patch or 4.0, and current versions of anything that touches bytecode or the JVM: Mockito and Byte Buddy, Lombok, JaCoCo, MapStruct and any Java agent like an APM agent.

Then, if they want more

If Boot itself needs upgrading, I do that first on Java 17 as a separate release. Then I change the Java version in all three places together: the Maven or Gradle toolchain, the CI image and the runtime base image.

I run the full test suite and look for typical failures: InaccessibleObjectException from reflection into JDK internals, removed APIs, and annotation processors that no longer run automatically since JDK 23. I also configure Mockito as a startup agent to get rid of the dynamic agent warning.

I read the release notes for behaviour changes, like UTF-8 becoming the default charset, the Security Manager being permanently disabled since JDK 24, and GC changes.

Finally I deploy one canary instance and compare latency, memory, GC pauses and errors with the Java 17 instances for at least a day before rolling out fully, and only after that do we start using new language features.

About this answer

Last updated
12 November 2026
Versions it names
Java 25, Java 17, Java 24, Java 21
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "You are upgrading a Spring Boot service from Java 17 to Java 25. What steps do you...": https://scrivio-interview-library.netlify.app/architecture/modernization/798c1312cb/