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)
More Related questions...