Spring Boot Interview Questions
Auto-configuration, starters, IoC & dependency injection, stereotypes, Spring MVC, Spring Data JPA, transactions, AOP, Actuator, Security and testing.
61 questions
Popular Searches
1. What is Spring Boot and how does it differ from the Spring Framework?
easyFundamentals 6 mins2. What is auto-configuration in Spring Boot and how does it work?
mediumConfiguration 7 mins3. What are Spring Boot starters and why are they useful?
easyDependencies 6 mins4. What is dependency injection in Spring and how does the IoC container work?
mediumCore Container 7 mins5. What is the difference between @Component, @Service, @Repository, and @Controller in Spring?
easyStereotype Annotations 6 mins6. What is the difference between @Controller and @RestController in Spring?
easyWeb Layer 6 mins7. What are Spring bean scopes and how do singleton and prototype differ?
mediumBean Scopes 7 mins8. What is the Spring bean lifecycle and what callbacks does it provide?
mediumBean Lifecycle 8 mins9. What is the difference between @Autowired field, constructor, and setter injection?
mediumDependency Injection 8 mins10. What is @SpringBootApplication and what annotations does it combine?
easyCore Annotations 5 mins11. How does Spring Boot handle application configuration with application.properties and profiles?
mediumConfiguration 6 mins12. What is Spring Data JPA and how do repository interfaces work?
mediumData Access 6 mins13. What is the difference between JpaRepository, CrudRepository, and PagingAndSortingRepository?
mediumSpring Data JPA 7 mins14. How does transaction management work in Spring with @Transactional?
mediumTransactions 8 mins15. What is the propagation and isolation level of a Spring transaction?
hardTransactions 9 mins16. What is Spring AOP and how do aspects, advice, and pointcuts work?
mediumAspect-Oriented Programming 7 mins17. How does exception handling work in Spring MVC with @ControllerAdvice?
mediumSpring MVC 7 mins18. What is the DispatcherServlet and how does the Spring MVC request flow work?
mediumSpring MVC 7 mins19. What is @RequestMapping and what are its HTTP-method shortcut annotations?
easyWeb MVC 6 mins20. What is the difference between @RequestParam, @PathVariable, and @RequestBody?
mediumRequest Binding 7 mins21. How does validation work in Spring Boot with @Valid and Bean Validation?
mediumValidation 7 mins22. What is Spring Boot Actuator and what does it provide?
easyObservability 6 mins23. How does Spring Security handle authentication and authorization?
mediumSecurity 7 mins24. What is the difference between @Bean and @Component in Spring?
mediumDependency Injection 6 mins25. What is a Spring profile and how do you configure environment-specific beans?
mediumConfiguration 7 mins26. How does Spring Boot embed a web server and how does the embedded Tomcat work?
mediumWeb Server 8 mins27. What is the N+1 query problem in Spring Data JPA and how do you solve it?
hardSpring Data JPA 9 mins28. What is the difference between eager and lazy loading in JPA/Hibernate?
mediumJPA / Hibernate 7 mins29. How do you write integration tests in Spring Boot with @SpringBootTest?
mediumTesting 7 mins30. What is @ConfigurationProperties and how does it bind external configuration?
mediumConfiguration 7 mins31. Why does @Transactional have no effect when a method is called from within the same class?
hardTransactions 8 mins32. An auto-configuration you expected did not apply — how do you debug it?
hardConfiguration 8 mins33. The same property is set in three places — how does Spring Boot decide which value wins?
mediumConfiguration 7 mins34. Your Spring Boot test suite has become very slow — how does test context caching work and how do you fix it?
hardTesting 8 mins35. What has to change when migrating an application to Spring Boot 3?
hardUpgrades 9 mins36. Requests are timing out waiting for a database connection — how do you diagnose and tune the HikariCP pool?
hardData Access 9 mins37. How do you configure Spring Boot liveness and readiness probes for Kubernetes, and why must they differ?
hardOperations 9 mins38. Requests fail during every deployment — how does graceful shutdown work in Spring Boot?
mediumOperations 7 mins39. @Cacheable is returning stale or wrong data — what are the common pitfalls of Spring's cache abstraction?
hardCaching 9 mins40. How would you write your own Spring Boot starter and auto-configuration for a shared internal library?
hardConfiguration 9 mins41. @Async work is losing the security context and swallowing exceptions — how do you configure it correctly?
hardConcurrency 9 mins42. Two users update the same record concurrently — how do you handle it with optimistic locking in Spring Data JPA?
hardData Access 9 mins43. How does Spring Boot decide the order in which auto-configurations are applied, and why does that order matter?
hardAuto-configuration 9 mins44. How do the @Conditional family of annotations decide whether a bean is created, and where do they commonly misfire?
hardAuto-configuration 9 mins45. Why can REQUIRES_NEW propagation deadlock an application under load?
hardTransactions 10 mins46. What causes LazyInitializationException, and why is open-session-in-view a poor way to avoid it?
hardJPA and Hibernate 10 mins47. How do you choose between JOIN FETCH, entity graphs and batch fetching when tuning Hibernate reads?
hardJPA and Hibernate 10 mins48. Which timeouts must you configure in a Spring Boot service, and what happens if you leave them at their defaults?
hardResilience 9 mins49. How do you write a custom Actuator health indicator without causing cascading restarts?
hardActuator and Observability 9 mins50. How would you expose Actuator safely in production?
mediumActuator and Observability 8 mins51. How do you supply configuration to a Spring Boot service running in containers, and how do changes take effect?
mediumConfiguration 9 mins52. What happens when you inject a request-scoped bean into a singleton, and how do you make it work?
hardBean Scopes 9 mins53. How do you choose between RestTemplate, RestClient and WebClient, and what must you configure on any of them?
mediumHTTP Clients 9 mins54. What is back-pressure in Project Reactor, and why is one blocking call so damaging in WebFlux?
hardReactive 10 mins55. How would you design consistent API error responses in Spring Boot?
mediumError Handling 9 mins56. When should a Spring Boot service retry a failed call, and when should it open a circuit breaker instead?
hardResilience 10 mins57. How do you decide between @WebMvcTest, @DataJpaTest and a full @SpringBootTest?
mediumTesting 9 mins58. How do you run integration tests against real infrastructure without making the build slow or flaky?
hardTesting 9 mins59. How would you diagnose and reduce a Spring Boot application's startup time?
hardPerformance 10 mins60. What changes when you build a Spring Boot application as a GraalVM native image?
hardNative and AOT 10 mins61. What is the difference between a servlet filter, a HandlerInterceptor and an aspect, and how do you order them?
mediumWeb Layer 9 mins