Top 50 Spring Boot Interview Questions & Rapid Answers
Ace your Spring Boot technical interview with high-frequency questions, rapid-fire 30-second answers, and deep trap explanations.
Technical interviews for Senior Spring Boot roles evaluate your grasp of architectural mechanisms, concurrency traps, and internal implementations rather than simple syntax memorization.
Here is a curated collection of high-frequency interview questions with crisp, 30-second answers and critical trap questions.
01Part 1: Spring Core & Bean Lifecycle
1. What is the difference between @Component, @Service, and @Repository?
Rapid Answer: Mechanically, all three are stereotypic specializations of @Component that register beans with the IoC container. However, @Repository adds automatic translation of database-specific exceptions into Spring’s DataAccessException hierarchy. @Service documents domain business logic, and @Component is the generic fallback.
2. What happens if a Prototype bean is injected into a Singleton bean?
Rapid Answer: The prototype bean is instantiated only once when the singleton bean is created. Subsequent calls to the singleton bean reuse the exact same prototype instance.
The Fix: Use @Lookup method injection or ObjectProvider<PrototypeBean> so a new prototype instance is retrieved on demand.
3. Can @PostConstruct or @PreDestroy run on Prototype beans?
Rapid Answer: @PostConstruct runs on prototype beans, but @PreDestroy does not. Spring instantiates and configures prototype beans, but hands them off to the caller and does not manage their complete destruction lifecycle.
Loading the rest of the lesson…