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);
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
