Scrivio Interview library

Spring Boot backend interviews

Preparing for a backend role built on Spring Boot. From the container to a request, then transactions, JPA, security, testing, messaging and resilience, in the order a service is built.

16 questions, about 1 and a half hours of reading
Start with the first question
  1. What does inversion of control mean in Spring, and how is it different from a class creating its own dependencies or using a service locator?IoC container6 min
  2. Why is constructor injection recommended over field injection in Spring? Is @Autowired needed on the constructor?Dependency injection6 min
  3. List the steps Spring goes through to create a singleton bean, from instantiation to ready for use, and the steps at shutdown.Bean lifecycle6 min
  4. What does singleton scope mean in Spring, and how is it different from the singleton design pattern?Bean scopes5 min
  5. Explain how @SpringBootApplication leads to a DataSource bean being created when you add spring-boot-starter-jdbc and a database driver.Auto-configuration5 min
  6. When would you use @Value and when @ConfigurationProperties? List the differences.Externalized configuration5 min
  7. Describe the full life of an HTTP request in a Spring Boot MVC application, from the socket to the response.Spring MVC architecture6 min
  8. What does @RestController add compared to @Controller, and what do @GetMapping and @RequestMapping do?REST controllers5 min
  9. What is @RestControllerAdvice, and how do you limit it to certain controllers?Error handling5 min
  10. How does Spring apply features such as @Transactional, @Async and @Cacheable to your beans?Aspect-oriented programming6 min
  11. How does @Transactional work in Spring? Describe what happens from the moment a caller invokes an annotated method on a bean.Transactions6 min
  12. What is the persistence context (first-level cache), and what guarantee does it provide within a transaction?JPA and Hibernate fundamentals6 min
  13. Describe the path of an HTTP request through Spring Security in a Spring Boot servlet application, from the servlet container to your controller. Name the main filters in order for an application with form login and CSRF enabled.Spring Security architecture6 min
  14. What does @WebMvcTest load and not load, and how does it differ from @DataJpaTest?Spring Boot testing5 min
  15. Explain how a Kafka consumer group assigns partitions to consumers and what happens during a rebalance. A topic has 6 partitions and a Spring @KafkaListener has concurrency = 3 in each of 4 pods. How many consumers actually receive data?Apache Kafka with Spring7 min
  16. Describe the states of a Resilience4j circuit breaker and what moves it between them. What do failureRateThreshold, slidingWindowSize, minimumNumberOfCalls and waitDurationInOpenState control?Resilience5 min

Mark a question as done on its page and it is ticked here. Kept in this browser only.