← Back to blog

December 3, 2026 · 12 min read

Upgrading Spring Boot 2.7 to 3.x: The Checklist

  • #Java
  • #Spring Boot
  • #upgrades
  • #migration

A Spring Boot 2.7 to 3 migration has a reputation for being painful, and some of that is earned. It's the release that moved to Java 17, swapped javax.* for jakarta.*, shipped Spring Security 6 and Hibernate 6, and removed everything 2.x had deprecated. Most of it is mechanical, though. What hurts is doing it all in one commit and then trying to work out which of forty changes broke the build.

I went through this on a modernization of 45 microservices, from Java 11 to 25 and Spring Boot 2.7 to 3.5. This post is the checklist in the order I'd run it, built on the official Spring Boot 3.0 Migration Guide. To keep it honest, I built a small 2.7.18 service (web, validation, security, actuator, Prometheus), migrated it, and ran its tests at every step: on 2.7.18, on 3.0.13 and on 3.5.16. Where something below says "this fails", I watched it fail.

One thing about timing before the list. It's December 2026. Spring Boot 3.5's open source support ended in June, and 4.0's ends on December 31. If you're still on 2.7, 3.x is a stop on the way, not where you end up. The good news is that the 2 to 3 jump is the hard one. 3.5 to 4.x is a much smaller step, and I covered where 4.x is now in Spring Boot 4.2: What Changes for You.

The upgrade path in stages: latest 2.7.x, then Java 17 on 2.7, then Spring Boot 3.0.x with a green build, then 3.x minors up to 3.5, then 4.x, with one concern per commit inside each stage

1. Get to the latest 2.7.x first

The migration guide's first instruction is the one people skip: before you start, upgrade to the latest 2.7.x. That's 2.7.18. The reason is in a single line further down the guide. Classes, methods and properties that were deprecated in 2.x are removed in 3.0.

On 2.7.18 those deprecations are still warnings. On 3.0 they're compile errors with no hint about what replaced them. So, on 2.7:

  • Bump to 2.7.18 and get the build green.
  • Compile with -Xlint:deprecation (or read your IDE's warnings) and fix every Spring deprecation you can. WebSecurityConfigurerAdapter is already deprecated in 2.7's Spring Security 5.7, so it can go now.
  • Bump your other libraries to versions that have a Boot 3 compatible release. Spring Cloud is a common blocker: each Boot generation needs its own release train.

Every item you fix here is one less thing breaking at the same time as the namespace change.

2. Raise the baseline to Java 17

Spring Boot 3.0 needs Java 17 or later. Do this step on 2.7, as its own change. Boot 2.7 runs on Java 17 fine, and the sample service built and passed its tests on 2.7.18 with Corretto 17. That means any break you see here is a JDK problem (an old Lombok, a bytecode library, a --add-opens flag you were relying on) and not a Spring problem.

If you're coming from Java 8 or 11, that jump has its own list of surprises. I'd move the JDK first, let it settle for a deploy or two, and only then touch Spring. If you're choosing between JDKs, Which Java Version Should You Run in 2027? covers the options; for this migration, anything from 17 up works.

3. Bump to Spring Boot 3.0.x and let the compiler talk

Now change the parent version. I went to the latest 3.0.x rather than straight to 3.5, because the 3.0 migration guide describes exactly that jump. The minor releases after it each have their own release notes, and it's easier to read them one at a time once you're on a green 3.0 build.

Before you edit anything by hand, look at OpenRewrite. It has a recipe for this upgrade, and running it on the sample service did most of the mechanical work. This is the command that ran (rewrite-maven-plugin 6.46.1, rewrite-spring 6.37.1):

mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \
  -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:RELEASE \
  -Drewrite.activeRecipes=org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_0 \
  -Drewrite.exportDatatables=false

It changed four files: it set the parent to 3.0.13, rewrote the javax imports, converted the security configuration and renamed three properties. Run it on a clean working tree so git diff shows you exactly what it did, and review that diff like a pull request from someone you don't know yet. The Art of Code Review covers what to look for.

The sections below are what it changed, plus what neither it nor the compiler will catch.

javax to jakarta

Spring Boot 3.0 is built on Jakarta EE 10 (Servlet 6.0, JPA 3.1, and so on), and Jakarta EE uses jakarta packages instead of javax. In the sample that meant validation:

// before (2.7)
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;

// after (3.x)
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;

The same goes for javax.persistence, javax.servlet, javax.transaction and so on. Your own code is the easy part. The real work is dependencies that still pull in javax artifacts: an old client library, an internal shared jar, a servlet filter someone wrote in 2017. Run mvn dependency:tree (or gradle dependencies) and search for javax. before you assume you're done. If you've never had to read one of those trees, Maven vs. Gradle Explained explains what you're looking at.

Not every javax package moves, by the way. javax.sql, javax.crypto and the rest that ship with the JDK stay where they are. A blind find-and-replace on javax. will break them, which is one more reason to let a tool that understands types do it.

Spring Security 6

Spring Boot 3.0 ships Spring Security 6.0, and WebSecurityConfigurerAdapter is gone. Here's the 2.7 configuration from the sample:

@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .csrf().disable()
            .authorizeRequests()
                .antMatchers("/actuator/health").permitAll()
                .antMatchers("/api/**").authenticated()
                .anyRequest().denyAll()
            .and()
            .httpBasic();
    }
}

And here's what it looks like after the migration, as a SecurityFilterChain bean with the lambda DSL. This version passes the same tests on 3.0.13 and 3.5.16:

@Configuration
public class SecurityConfig {

    @Bean
    SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
        http
            .csrf(csrf -> csrf.disable())
            .authorizeHttpRequests(requests -> requests
                .requestMatchers("/actuator/health").permitAll()
                .requestMatchers("/api/**").authenticated()
                .anyRequest().denyAll())
            .httpBasic(withDefaults());
        return http.build();
    }
}

Three changes to notice: authorizeRequests became authorizeHttpRequests, antMatchers became requestMatchers, and the chained .and() style gave way to lambdas. (CSRF is off here because the sample is a stateless API using HTTP Basic. Don't copy that line into an app with browser sessions.)

The migration guide also suggests going through Spring Security 5.8 first, since Security has its own 5.8 and 6.0 migration guides. Two behaviour changes are worth knowing even if the code compiles: the security filter now runs for every dispatch type, and ReactiveUserDetailsService is no longer auto-configured when there's an AuthenticationManagerResolver. If you want the concepts behind the filter chain before you touch it, Securing Your API: Spring Security Fundamentals walks through them.

Auto-configuration registration (if you publish starters)

If your team has internal starters, they probably register auto-configuration in META-INF/spring.factories under the EnableAutoConfiguration key. Boot 3.0 no longer reads that key. Auto-configurations go in META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports, one class per line. Other spring.factories keys still work. A library that has to support both 2.x and 3.x can list its classes in both places.

This is a nasty one because nothing fails to compile. The starter just silently stops configuring anything.

4. Run the properties migrator, and read what it says

Many configuration keys were renamed in 3.0. Spring Boot gives you a tool for this: add spring-boot-properties-migrator as a runtime dependency, and at startup it reports the old keys and maps them to the new ones for that run.

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-properties-migrator</artifactId>
    <scope>runtime</scope>
</dependency>

I ran it on 3.5.16 against the original 2.7 application.properties. This is what it printed (trimmed):

WARN  o.s.b.c.p.m.PropertiesMigrationListener :
The use of configuration keys that have been renamed was found in the environment:
	Key: management.metrics.export.prometheus.enabled
		Replacement: management.prometheus.metrics.export.enabled
	Key: spring.redis.host
		Replacement: spring.data.redis.host

ERROR o.s.b.c.p.m.PropertiesMigrationListener :
The use of configuration keys that are no longer supported was found in the environment:
	Key: server.max-http-header-size
		Reason: Replacement key 'server.max-http-request-header-size' uses an incompatible target type

Look at the second block. The migrator mapped the two renamed keys, and a test confirmed the app saw spring.data.redis.host. But it did not map server.max-http-header-size: it reported it and left it alone, so the new key was simply unset. If you treat the migrator as "it'll handle it" and don't read the log, you've just lost your header size limit without any error.

The properties migrator's two outcomes: renamed keys such as spring.redis.host and management.metrics.export.prometheus.enabled are remapped for the run and logged as WARN, while unsupported keys such as server.max-http-header-size are only logged as ERROR and not applied

The renames that come up most often, all from the migration guide:

2.7 key3.x key
spring.redis.*spring.data.redis.*
spring.data.cassandra.*spring.cassandra.*
management.metrics.export.<product>.*management.<product>.metrics.export.*
server.max-http-header-sizeserver.max-http-request-header-size (now request headers only)
spring.jpa.hibernate.use-new-id-generator-mappingsremoved

Fix the keys in your config files (and in your environment variables, Helm charts and config server, which are easy to forget), then remove the migrator. The guide is explicit that it's a migration aid, not something to ship. If you keep config per environment, this is a good moment to tidy it up; Spring Boot Configuration: Profiles, Properties, and Secrets covers a layout that keeps it manageable.

5. The changes that only fail at runtime

This is the section that justifies having tests. After OpenRewrite, the sample compiled cleanly on 3.0.13, and one test still failed:

trailingSlashStillMatchesOn27  <<< FAILURE!
java.lang.AssertionError: Status expected:<200> but was:<404>

Two columns: what the compiler catches in a 2.7 to 3 migration (javax imports, WebSecurityConfigurerAdapter, removed deprecated APIs, antMatchers) versus what only tests or production catch (trailing slash 404s, unmapped properties, Hibernate 6 query and ID behaviour, metric and log format changes, masked actuator values, spring.factories auto-configuration)

Trailing slash matching is off

Spring Framework 6 changed the default: GET /api/orders/1/ no longer matches @GetMapping("/{id}"). On 2.7 it returned 200. On 3.x it's a 404. Your own code looks fine; it's the callers who break. Clients, gateways and health checks with a stray / start getting 404s.

The right fix is to make clients use the canonical URL. If you need time for that, there's an escape hatch, which I verified on 3.5.16 (it still compiles on 4.2.0, deprecated):

@Configuration
class LegacyPathConfig implements WebMvcConfigurer {

    @Override
    @SuppressWarnings("deprecation")
    public void configurePathMatch(PathMatchConfigurer configurer) {
        // Temporary: keep "/api/orders/1/" working while clients are fixed.
        configurer.setUseTrailingSlashMatch(true);
    }
}

It's deprecated, so give it an owner and a removal date. WebFlux has the equivalent in configurePathMatching.

Hibernate 6

Spring Boot 3.0 moves to Hibernate 6.1. Hibernate's artifacts now use the org.hibernate.orm group ID, so any explicit org.hibernate:hibernate-* dependency needs updating, and the old ID generator mappings are no longer supported. Beyond that, read Hibernate's own 6.0 and 6.1 migration guides alongside your query tests. Hibernate 6 rewrote its query parsing, so the breakages show up as a query that now fails or returns something slightly different, not as a compile error. Run your repository tests against a real database, not just H2. Testing Your Spring Boot Application covers how to set those up.

Other data-access bumps from the guide that bite people: Flyway 9, Liquibase 4.17, and the MySQL driver moving to com.mysql:mysql-connector-j.

Metrics and tracing

Boot 3.0 moves to Micrometer 1.10 and its Observation API. The old Boot-specific instrumentation is gone: WebMvcMetricsFilter is replaced by Spring Framework's ServerHttpObservationFilter, and custom tag providers become observation conventions. If you used Spring Cloud Sleuth for tracing, it doesn't support Boot 3. Micrometer Tracing replaces it.

What to check: dashboards and alerts that use metric names or tags. A panel that goes quiet after the upgrade isn't a sign of a healthier service. Diff /actuator/prometheus output from before and after, and check your tracing headers still propagate across services that are on different versions. Observability 101 has more on why those three signals need to agree.

Smaller defaults that change what you see

  • Log timestamps are ISO-8601 by default now. If a log parser expects the old yyyy-MM-dd HH:mm:ss.SSS, set logging.pattern.dateformat or fix the parser.
  • Actuator /env and /configprops mask all values by default. That's the right default; use show-values deliberately if you need it.
  • httptrace is now httpexchanges.
  • Only the health endpoint is exposed over JMX by default.
  • @ConstructorBinding isn't needed on the type any more; remove it.
  • Apache HttpClient 4 support is gone from RestTemplate. Use httpclient5, or it may quietly fall back to the JDK client with different timeout behaviour.

6. Then walk up the 3.x line, one minor at a time

Once 3.0.x is green and deployed, go up minor by minor to 3.5. Each one is small. Read its release notes, bump, run the tests, ship. This is also when to add -Xlint:deprecation back, because 3.x deprecations are 4.x removals.

The sample's last step was 3.5.16 on Java 25 with the new property names and no migrator: all four tests passed, including one that pins the new trailing-slash behaviour so nobody turns it back on by accident.

How to stage it so you can debug it

The order matters more than any single item above. What works, whether it's one service or forty-five:

  1. Green build first. Each stage starts and ends with a passing build. Never stack a second change on a red build.
  2. One concern per commit. JDK, then Boot version, then security, then properties, then each runtime fix. When something breaks in staging, you can bisect it.
  3. Write the tests the compiler can't. URL shapes, security rules, the configuration values you rely on. The trailing slash test in the sample cost five lines and caught the only real behaviour change.
  4. Pick a pilot, then let the boring services go fast. The first service teaches you the list; the next ones are mostly the same diff.
  5. Remove the scaffolding. The properties migrator, the trailing slash escape hatch and any @SuppressWarnings each need an owner and a date.

The migration is a lot of small, dull changes, and that's fine. The trouble comes from doing them all in the same commit.

Sources