Spring / Spring Boot 4 Basics Interview Questions
What are the key breaking changes removed in Spring Boot 4 that were deprecated in Boot 3?
Spring Boot 4 follows a strict deprecation policy: everything deprecated in Spring Boot 3.x is removed in 4.0 with no fallback. This is why the recommended migration path is to first upgrade to Boot 3.5 and fix all deprecation warnings before touching Boot 4.
| What was removed | Category | Replacement |
|---|---|---|
| JUnit 4 support | Testing | Use JUnit 5 (Jupiter) -- Boot 3 already required it |
| Undertow embedded server | Web | Tomcat 11 or Jetty 12.1 |
| spring-boot-starter-web (monolithic) | Modularisation | spring-boot-starter-webmvc or spring-boot-starter-webflux |
| spring-boot-autoconfigure (monolith JAR) | Modularisation | 70+ individual technology modules |
| javax.annotation / javax.inject support | Jakarta EE | jakarta.annotation / jakarta.inject |
| RestTemplate (discouraged) | HTTP Client | RestClient or HTTP Service Client (@HttpExchange) |
| Old Actuator property prefixes | Observability | Updated management.* property paths |
| AntPathMatcher for HTTP mappings (deprecated) | MVC | PathPatternParser (PathPattern-based matching) |
| spring.jackson2.* properties | JSON | spring.jackson.* (Jackson 3 config) |
# WRONG (Boot 3 style, removed in Boot 4): # spring.jackson2.serialization.write-dates-as-timestamps=false # CORRECT (Boot 4): spring.jackson.serialization.write-dates-as-timestamps=false // Migration script check: find deprecated patterns // Run OpenRewrite to automate many changes: // mvn rewrite:run \ // -Drewrite.activeRecipes=\ // org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_5,\ // org.openrewrite.java.spring.boot4.UpgradeSpringBoot_4_0 // RestTemplate to RestClient migration: // Spring Boot 3 (discouraged): RestTemplate rt = new RestTemplate(); String result = rt.getForObject("http://api/data", String.class); // Spring Boot 4 (recommended): RestClient client = RestClient.create(); String result = client .get() .uri("http://api/data") .retrieve() .body(String.class);
More Related questions...