Prev Next

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.

Spring Boot 4 migration checklist
CategoryActionCommon pitfall
Pre-migrationUpgrade to Spring Boot 3.5 and fix ALL deprecation warningsDeprecations from 3.x are hard-deleted in 4.0 -- skipping this step guarantees breakage
JavaConfirm Java 17 minimum; recommend Java 21 for virtual threadsUsing Java 11 will fail at startup
KotlinUpgrade to Kotlin 2.2 if using KotlinKotlin null-safety compilation failures from JSpecify annotations
DependenciesUpdate BOM version to 4.x.x; rename starters (webmvc, webflux)Old spring-boot-starter-web still resolves but triggers a deprecation
JacksonMigrate from com.fasterxml.jackson to tools.jackson; audit JSON testsSilent date format and property ordering changes break JSON contracts
ServerRemove Undertow dependency; migrate to Tomcat 11 or Jetty 12.1Application fails to start if Undertow is still on classpath
PersistenceReview Hibernate 7.1 detached entity behaviourLenient reassociation silently broken; explicit merge required
SecurityReview Spring Security 7 CSRF defaultsREST API tests fail silently after CSRF default change
javax.* importsRun OpenRewrite Migrate_To_Jakarta_EE_10 recipeAny remaining javax.* imports cause ClassNotFoundException at runtime
TestingReplace JUnit 4 tests (removed); update MockMvc to RestTestClientJUnit 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)

What does OpenRewrite's UpgradeJackson_2_3 recipe handle automatically?
Why do Kotlin developers often have the most compilation failures when migrating to Spring Boot 4?

More Related questions...

What is Spring Boot 4 and when was it released? What is the complete modularisation of Spring Boot 4 and why does it matter? What is the Java version baseline in Spring Boot 4 and what Java features does it unlock? What is Jakarta EE 11 and what changes does it bring in Spring Boot 4? How does Spring Boot 4 auto-configuration work and what is the new @AutoConfiguration annotation? What is native API versioning in Spring Boot 4 and how do you use it? What are JSpecify nullability annotations in Spring Boot 4 and why are they important? What changed with Jackson in Spring Boot 4 and what are the migration considerations? What are @Retryable and @ConcurrencyLimit in Spring Boot 4 and how do they work? What are HTTP Service Clients in Spring Boot 4 and how do you define them? What are the key breaking changes removed in Spring Boot 4 that were deprecated in Boot 3? How does Spring Boot 4 handle dependency injection and what are the core stereotypes? What is Spring Boot's application.properties / application.yml and how does configuration work? What are Spring Boot profiles and how do you use them for environment-specific configuration? How does Spring Boot 4 testing work with @SpringBootTest and test slices? What is Spring Boot Actuator and what does it provide in Boot 4? How does Spring Boot 4 handle data access with Spring Data JPA? What is Spring Security in Spring Boot 4 and what are the key Boot 4 changes? What is the Spring Boot starter parent (POM) and how do you set up a Spring Boot 4 project? What is @SpringBootApplication and what does it combine? How do you build REST APIs with Spring Boot 4 using @RestController? How does Bean Validation work with Spring Boot 4? What is Spring Boot's embedded server and how do you configure it? What is Spring Boot's transaction management with @Transactional? What is Spring Boot's caching abstraction and how do you use it? What is Spring Boot's observability stack in Boot 4 with Micrometer and OpenTelemetry? How does Spring Boot 4 support GraalVM native images? What is Spring WebFlux and reactive programming in Spring Boot 4? What is Spring Boot's exception handling with @RestControllerAdvice? How do you use Spring Data MongoDB and other NoSQL stores in Spring Boot 4? How does Spring Boot 4 handle async processing with @Async? What is Spring Boot's externalized configuration with @Value and @ConfigurationProperties? What is Spring Boot's messaging support with Kafka in Boot 4? How do you schedule tasks in Spring Boot 4 with @Scheduled? What is Spring AI and how does it integrate with Spring Boot 4? How does Spring Boot 4 handle logging configuration? What is Spring Boot 4 migration from Boot 3: complete checklist and common pitfalls? What is Spring Boot DevTools and how does it improve development productivity? How does Spring Boot 4 support containerised deployments with Docker? What is the Spring Boot 4 vs Spring Boot 3 comparison and what are the key takeaways?
Show more question and Answers...


Comments & Discussions