Spring / Spring Boot 4 Basics Interview Questions
What is Spring Boot 4 migration from Boot 3: complete checklist and common pitfalls?
Migrating to Spring Boot 4 requires addressing several categories of change. Here is a practical checklist with the most common pitfalls teams encounter.
| Category | Action | Common pitfall |
|---|---|---|
| Pre-migration | Upgrade to Spring Boot 3.5 and fix ALL deprecation warnings | Deprecations from 3.x are hard-deleted in 4.0 -- skipping this step guarantees breakage |
| Java | Confirm Java 17 minimum; recommend Java 21 for virtual threads | Using Java 11 will fail at startup |
| Kotlin | Upgrade to Kotlin 2.2 if using Kotlin | Kotlin null-safety compilation failures from JSpecify annotations |
| Dependencies | Update BOM version to 4.x.x; rename starters (webmvc, webflux) | Old spring-boot-starter-web still resolves but triggers a deprecation |
| Jackson | Migrate from com.fasterxml.jackson to tools.jackson; audit JSON tests | Silent date format and property ordering changes break JSON contracts |
| Server | Remove Undertow dependency; migrate to Tomcat 11 or Jetty 12.1 | Application fails to start if Undertow is still on classpath |
| Persistence | Review Hibernate 7.1 detached entity behaviour | Lenient reassociation silently broken; explicit merge required |
| Security | Review Spring Security 7 CSRF defaults | REST API tests fail silently after CSRF default change |
| javax.* imports | Run OpenRewrite Migrate_To_Jakarta_EE_10 recipe | Any remaining javax.* imports cause ClassNotFoundException at runtime |
| Testing | Replace JUnit 4 tests (removed); update MockMvc to RestTestClient | JUnit 4 is gone; vintage engine not included in spring-boot-starter-test |
# Maven: run OpenRewrite migration recipes mvn rewrite:run \ -Drewrite.activeRecipes=\ org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_5,\ org.openrewrite.java.spring.boot4.UpgradeSpringBoot_4_0,\ org.openrewrite.java.jackson.UpgradeJackson_2_3 # What OpenRewrite handles automatically: # - Package renames (javax -> jakarta) # - Jackson package renames (com.fasterxml -> tools.jackson) # - Deprecated API replacements # - Configuration property renames # # What OpenRewrite CANNOT handle: # - Jackson date serialisation default change # - JSON property ordering default change # - Hibernate detached entity behaviour # - Spring Security CSRF default changes # (these require manual review of integration tests)
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...
