Top 25 Spring Boot Interview Questions for Experienced Developers

Top 25 Spring Boot Interview Questions for Experienced Developers Work through these 15 questions out loud. Open any question for the full model answer, the trap to avoid, and the follow-up a panel usually asks.

  1. What are virtual threads in Java 21 and when should you use them?

    Virtual threads excel when code blocks on IO — HTTP clients, JDBC, file reads — allowing one platform thread to serve thousands of concurrent requests. For CPU-heavy parallel...

    Full answer

  2. What is the Java Platform Module System (JPMS) and who needs it?

    Use modules when building custom JDK images or publishing strict API boundaries. Typical microservice: no module-info — Spring Boot repackages classpath. Watch for illegal...

    Full answer

  3. What changed migrating Spring Boot 2 to Spring Boot 3 (Jakarta EE)?

    Upgrade to Java 17+, replace imports javax.persistence → jakarta.persistence, update Spring Security config to SecurityFilterChain lambda DSL, run OpenRewrite migration recipe,...

    Full answer

  4. How does spring.config.import work for externalized configuration?

    In K8s: spring.config.import=optional:configtree:/etc/secrets/,optional:configtree:/etc/config/ mounts volumes as properties. Vault:...

    Full answer

  5. How do Spring Boot Actuator health probes work with Kubernetes?

    Enable probes, configure K8s readinessProbe on /actuator/health/readiness, liveness on /actuator/health/liveness. Custom HealthIndicator for critical deps on readiness group...

    Full answer

  6. Explain @ConfigurationProperties vs @Value.

    @ConfigurationProperties(prefix = "app.payment") record PaymentProps(int timeout, String apiUrl) {} — validated, testable, grouped. Use @Value only for single feature flags....

    Full answer

  7. How do you enable virtual threads in Spring Boot 3.2+?

    application.yml: spring.threads.virtual.enabled=true on Java 21. Verify integration tests pass — especially security, transactions, MDC logging. Replace custom fixed thread...

    Full answer

  8. @RestController vs @Controller?

    @Controller is for traditional MVC — return "user/list" view name. @RestController adds @ResponseBody so return types become JSON/XML body — standard for REST APIs. Use...

    Full answer

  9. What are Spring Boot starters?

    spring-boot-starter-web brings spring-webmvc, Tomcat, Jackson with tested versions and enables WebMvcAutoConfiguration. You declare one starter instead of 10 coordinates....

    Full answer

  10. How does Bean Validation work in Spring Boot 3?

    DTO fields: @NotBlank, @Email, @Size. Controller: createUser(@Valid @RequestBody UserDto dto). Global @RestControllerAdvice maps MethodArgumentNotValidException to 400 + field...

    Full answer

  11. What are GraalVM native image considerations for Spring Boot?

    Use spring-boot-maven-plugin native profile + GraalVM 21. Run integration tests on native binary. Register reflection for Jackson/custom serializers. Trade longer CI builds for...

    Full answer

  12. How does Spring Boot auto-configuration work?

    @SpringBootApplication enables @EnableAutoConfiguration, which loads candidate configs from starters. Each auto-config uses @ConditionalOn* to register beans only when...

    Full answer

  13. How do you handle exceptions globally in Spring?

    Create @RestControllerAdvice with @ExceptionHandler(MethodArgumentNotValidException.class) returning 400 + field map, NotFoundException → 404, generic Exception → 500 without...

    Full answer

  14. How do you test Spring Boot applications?

    Unit test services with Mockito — no Spring. @WebMvcTest + MockMvc for controller contract. @DataJpaTest for repository queries. @SpringBootTest + Testcontainers for critical...

    Full answer

  15. How do you version REST APIs?

    We use /api/v1/users for clarity. Non-breaking: add optional JSON fields. Breaking: launch v2 path, maintain v1 for 6 months with Deprecation header. Spring maps...

    Full answer

Cracking the Spring Boot Interview: Tips and Must-Know Questions · Spring Boot Interview Questions and Answers · Top 50 Spring Boot Interview Questions and Answers (2026 Edition) · Top 40 Spring Boot Interview Questions | Must-Prepare before interview.

All interview question lists · Interview guides · Home · Support the platform