Prev Next

Spring / Spring Boot 4 Basics Interview Questions

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

1. What is Spring Boot 4 and when was it released?

Spring Boot 4.0 was released on November 20, 2025 , making it the most structurally significant Spring release since the move to Jakarta EE in Spring Boot 3.0 (2022). Spring Boot 4.1 followed on June 10, 2026 and is the current recommended version for new projects. Spring Boot 4 is described by t...

Read full answer

2. What is the complete modularisation of Spring Boot 4 and why does it matter?

One of the most architecturally significant changes in Spring Boot 4 is the complete modularisation of the codebase into 70+ focused JAR modules . Previously, the two monolithic JARs -- spring-boot-autoconfigure and spring-boot-test-autoconfigure -- contained auto-configuration for every supporte...

Read full answer

3. What is the Java version baseline in Spring Boot 4 and what Java features does it unlock?

Spring Boot 4 maintains Java 17 as the minimum baseline while adding first-class support for Java 25 . The decision to keep Java 17 as the minimum was deliberate -- as Spring Framework project lead Juergen Hoeller stated, "the current industry consensus is clearly around a Java 17 baseline." Java...

Read full answer

4. What is Jakarta EE 11 and what changes does it bring in Spring Boot 4?

Spring Boot 4 moves the Jakarta EE baseline from version 9/10 (used in Boot 3.x) to Jakarta EE 11 . This brings updated specifications for persistence, validation, servlets, and WebSockets. Jakarta EE 11 specification versions in Spring Boot 4 Specification Version Key changes Jakarta Servlet 6.1...

Read full answer

5. How does Spring Boot 4 auto-configuration work and what is the new @AutoConfiguration annotation?

Spring Boot's auto-configuration mechanism has been refined in version 4. The core concept remains: Spring Boot detects libraries on your classpath and automatically configures beans accordingly -- but the implementation is now spread across 70+ modules rather than a single monolithic JAR. // Spr...

Read full answer

6. What is native API versioning in Spring Boot 4 and how do you use it?

API versioning has historically been one of the most DIY aspects of Spring development -- teams built custom URL paths, header filters, or RequestCondition hacks. Spring Framework 7 (and Spring Boot 4) makes API versioning a first-class feature with native annotation-based support in both Spring ...

Read full answer

7. What are JSpecify nullability annotations in Spring Boot 4 and why are they important?

Spring Boot 4 adopts JSpecify annotations ( @Nullable , @NonNull , @NullMarked ) portfolio-wide, deprecating Spring's own org.springframework.lang annotations. JSpecify is a collaborative standard backed by Google, JetBrains, Broadcom (Spring), Uber, Oracle, and OpenJDK. JSpecify annotations Anno...

Read full answer

8. What changed with Jackson in Spring Boot 4 and what are the migration considerations?

Spring Boot 4 migrates from Jackson 2 to Jackson 3 as the primary JSON library. This is one of the highest-risk breaking changes for teams upgrading, because several serialisation behaviours change silently -- no compiler error, no deprecation warning, just different JSON output. Jackson 2 vs Jac...

Read full answer

9. What are @Retryable and @ConcurrencyLimit in Spring Boot 4 and how do they work?

Spring Boot 4 (via Spring Framework 7) brings built-in resilience patterns directly into the Spring context. Previously, retry required the separate spring-retry dependency plus @EnableRetry . Spring Boot 4 ships these capabilities as first-class features. // Spring Boot 3 (required separate depe...

Read full answer

10. What are HTTP Service Clients in Spring Boot 4 and how do you define them?

HTTP Service Clients (also called declarative HTTP clients) allow you to define REST client interfaces using annotations, similar to Feign clients but built natively into Spring. Spring Boot 4 adds auto-configuration for @HttpExchange interfaces, making it easy to create and inject HTTP clients a...

Read full answer

11. 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. Key removals in Spring Boot 4 What w...

Read full answer

12. How does Spring Boot 4 handle dependency injection and what are the core stereotypes?

Spring Boot 4 retains the same core dependency injection (DI) model as all previous Spring versions. The DI container, stereotype annotations, and bean lifecycle are unchanged -- Spring Boot 4's changes are at the infrastructure and ecosystem level, not the DI model itself. Spring DI stereotype a...

Read full answer

13. What is Spring Boot's application.properties / application.yml and how does configuration work?

Spring Boot externalises application configuration through application.properties or application.yml files, environment variables, system properties, and more. The configuration property source hierarchy determines which value wins when the same key appears in multiple places. Configuration prope...

Read full answer

14. What are Spring Boot profiles and how do you use them for environment-specific configuration?

Profiles allow different configuration to be activated based on the deployment environment (dev, test, staging, prod). Spring Boot supports profile-specific property files, conditional bean registration, and profile activation via environment variables. # src/main/resources/application.yml (base ...

Read full answer

15. How does Spring Boot 4 testing work with @SpringBootTest and test slices?

Spring Boot 4 provides a rich testing support framework. @SpringBootTest loads the full application context for integration tests, while test slice annotations load only a subset of the context for focused, faster unit tests. Spring Boot 4 test slice annotations Annotation Loads Use case @SpringB...

Read full answer

16. What is Spring Boot Actuator and what does it provide in Boot 4?

Spring Boot Actuator adds production-ready monitoring and management endpoints to any Spring Boot application. In Boot 4, the observability story has been tightened around OpenTelemetry with dedicated configuration properties. Key Actuator endpoints Endpoint HTTP What it shows /actuator/health GE...

Read full answer

17. How does Spring Boot 4 handle data access with Spring Data JPA?

Spring Boot 4 auto-configures Spring Data JPA when spring-boot-starter-data-jpa (or its modular equivalent) is on the classpath. With Hibernate 7.1 as the managed ORM and Jakarta Persistence 3.2, there are some important behavioural changes from Boot 3. // Entity class ( Jakarta Persistence 3.2 )...

Read full answer

18. What is Spring Security in Spring Boot 4 and what are the key Boot 4 changes?

Spring Boot 4 ships with Spring Security 7 , which introduces multi-factor authentication (MFA) and important changes to default security configurations -- particularly CSRF protection defaults that can silently break REST APIs. // Spring Boot 4 / Spring Security 7 : SecurityFilterChain @Configur...

Read full answer

19. What is the Spring Boot starter parent (POM) and how do you set up a Spring Boot 4 project?

The spring-boot-starter-parent POM sets sensible defaults for Maven builds: Java version, encoding, plugin versions, and dependency management via the Spring Boot BOM. It is the recommended way to start a Spring Boot project. 4.0...

Read full answer

20. What is @SpringBootApplication and what does it combine?

@SpringBootApplication is a composed annotation that is the standard entry point for Spring Boot applications. It combines three key annotations that together enable auto-configuration, component scanning, and configuration capabilities. // @SpringBootApplication = @SpringBootConfiguration // + @...

Read full answer

21. How do you build REST APIs with Spring Boot 4 using @RestController?

Building REST APIs in Spring Boot 4 uses the same @RestController + @RequestMapping model as previous versions, but with native API versioning, improved validation integration, and better null safety via JSpecify. import jakarta.validation.Valid ; import jakarta.validation.constraints. * ; import...

Read full answer

22. How does Bean Validation work with Spring Boot 4?

Spring Boot 4 auto-configures Jakarta Bean Validation 3.1 when spring-boot-starter-validation is on the classpath. Validation annotations on request bodies, path variables, and method parameters are enforced automatically. // DTO with validation constraints: public record CreateOrderRequest( @Not...

Read full answer

23. What is Spring Boot's embedded server and how do you configure it?

Spring Boot 4 ships with embedded web servers that start as part of the application JAR -- no external application server is needed. The supported embedded servers in Boot 4 are Tomcat 11 and Jetty 12.1 (Undertow was removed). Embedded server options in Spring Boot 4 Server Starter Notes Tomcat 1...

Read full answer

24. What is Spring Boot's transaction management with @Transactional?

Spring Boot 4 auto-configures transaction management when a data source is on the classpath. The @Transactional annotation declaratively wraps methods in a database transaction, with Spring AOP managing commit and rollback. // Service with transaction management: @Service public class OrderServic...

Read full answer

25. What is Spring Boot's caching abstraction and how do you use it?

Spring Boot 4 provides a caching abstraction that decouples application code from specific cache implementations. Using @EnableCaching and method-level annotations, you can cache method results and evict them declaratively. // Enable caching: @SpringBootApplication @EnableCaching public class App...

Read full answer

26. What is Spring Boot's observability stack in Boot 4 with Micrometer and OpenTelemetry?

Spring Boot 4 builds observability around Micrometer (metrics), Micrometer Tracing (distributed tracing), and OpenTelemetry (standard telemetry export). The management.opentelemetry.* property namespace is new in Boot 4. Observability pillars in Spring Boot 4 Pillar Library What it tracks Metrics...

Read full answer

27. How does Spring Boot 4 support GraalVM native images?

Spring Boot 4 has first-class support for compiling applications to GraalVM native images -- ahead-of-time compiled binaries that start in milliseconds and use a fraction of the heap compared to JVM-based deployments. Boot 4 requires GraalVM native-image 25 or later. # Requirements for native ima...

Read full answer

28. What is Spring WebFlux and reactive programming in Spring Boot 4?

Spring WebFlux is Spring's reactive web framework, built on Project Reactor. It is an alternative to Spring MVC for building non-blocking, asynchronous web applications. Spring Boot 4 supports both Spring MVC (servlet-based) and WebFlux (reactive) in the same framework. Spring MVC vs Spring WebFl...

Read full answer

29. What is Spring Boot's exception handling with @RestControllerAdvice?

@RestControllerAdvice provides a centralised, global exception handling mechanism for all controllers. It replaces the need to put @ExceptionHandler methods in every controller class. // Centralised exception handler: @RestControllerAdvice public class GlobalExceptionHandler { private static fina...

Read full answer

30. How do you use Spring Data MongoDB and other NoSQL stores in Spring Boot 4?

Spring Boot 4 auto-configures connections to MongoDB, Redis, Cassandra, Elasticsearch, and other NoSQL stores when their starters are on the classpath. The programming model mirrors Spring Data JPA but without SQL. // MongoDB entity: import org.springframework.data.annotation.Id ; import org.spri...

Read full answer

31. How does Spring Boot 4 handle async processing with @Async?

@Async makes a method execute in a separate thread asynchronously, returning a CompletableFuture (or void ) immediately while processing continues in the background. Spring Boot 4 automatically uses virtual threads when enabled. // Enable async processing: @SpringBootApplication @EnableAsync publ...

Read full answer

32. What is Spring Boot's externalized configuration with @Value and @ConfigurationProperties?

Spring Boot 4 provides two ways to inject configuration values into beans: @Value for simple individual values and @ConfigurationProperties for structured, type-safe groups of related properties. # application.yml: app: payment: gateway - url: https: // payment . example . com / api timeout - sec...

Read full answer

33. What is Spring Boot's messaging support with Kafka in Boot 4?

Spring Boot 4 ships with Spring for Apache Kafka 4.0 , which introduces Share Consumer support for Kafka Queues -- allowing multiple consumers in a group to share records from the same partition rather than partitions being locked to single consumers. // Producer: @Service public class OrderEvent...

Read full answer

34. How do you schedule tasks in Spring Boot 4 with @Scheduled?

Spring Boot 4 provides task scheduling via @EnableScheduling and @Scheduled annotations. In Boot 4, the auto-configuration for task scheduling supports multiple TaskDecorator beans, enabling better observability and context propagation. // Enable scheduling: @SpringBootApplication @EnableScheduli...

Read full answer

35. What is Spring AI and how does it integrate with Spring Boot 4?

Spring AI is a first-class Spring ecosystem project that reached 1.0 GA in May 2025 and is now on a 2.x development track. It provides a model-agnostic abstraction layer for integrating LLMs, vector stores, and AI pipelines into Spring Boot 4 applications. Spring AI core concepts Concept Descript...

Read full answer

36. How does Spring Boot 4 handle logging configuration?

Spring Boot 4 auto-configures Logback as the default logging framework (with SLF4J as the facade). Log4j2 and JUL are also supported. Boot 4 enhances structured logging for production observability. # Logging configuration in application.yml: logging: level: root: INFO # global default level com ...

Read full answer

37. 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 Category Action Common pitfall Pre-migration Upgrade to Spring Boot 3.5 and fix ALL deprecation warnings Depr...

Read full answer

38. What is Spring Boot DevTools and how does it improve development productivity?

Spring Boot DevTools accelerates development by providing automatic application restart, LiveReload, and property overrides for development environments. It is available only on the development classpath and has no effect in production.

«
»

Comments & Discussions