🍃 Section 5 · 29 questions

Spring Spring Boot

29 interview questions and answers in the Spring Spring Boot section.

Questions in this section

  1. What is Dependency Injection
  2. Difference between constructor, setter and field injection
  3. Which injection type is recommended and why
  4. What is a Bean in Spring
  5. How to create a Bean in Spring
  6. What is Bean Lifecycle
  7. What are the Bean Lifecycle stages
  8. What is BeanPostProcessor
  9. What do PostConstruct and PreDestroy methods do
  10. What is Bean scope
  11. What scopes exist in Spring
  12. Difference between singleton and prototype scope
  13. What is a proxy in Spring
  14. When does Spring create a proxy
  15. What is AOP Aspect-Oriented Programming
  16. What is aspect advice pointcut join point
  17. What does the Transactional annotation do
  18. Why Transactional does not work with self-invocation
  19. How to solve the self-invocation problem
  20. What is auto-configuration in Spring Boot
  21. How SpringBootApplication works
  22. What is a starter in Spring Boot
  23. What does the ComponentScan annotation do
  24. What is a Configuration class
  25. Difference between Component Service Repository Controller
  26. What does the Autowired annotation do
  27. What to do if there are multiple beans of the same type
  28. What is Qualifier
  29. What are profiles in Spring

Study navigator

A structured compilation of 29 core questions designed to prepare software engineers for Junior 🟢, Middle 🟡, and Senior 🔴 Spring & Spring Boot technical interviews.


📋 All Questions

# Question Difficulty
01 What is Dependency Injection ⭐
02 Difference between constructor setter and field injection ⭐⭐
03 Which injection type is recommended and why ⭐⭐
04 What is a Bean in Spring ⭐⭐
05 How to create a Bean in Spring ⭐⭐
06 What is Bean Lifecycle ⭐⭐⭐
07 What are the Bean Lifecycle stages ⭐⭐⭐
08 What is BeanPostProcessor ⭐⭐⭐
09 What do PostConstruct and PreDestroy methods do ⭐⭐
10 What is Bean scope ⭐⭐
11 What scopes exist in Spring ⭐⭐
12 Difference between singleton and prototype scope ⭐⭐
13 What is a proxy in Spring ⭐⭐⭐
14 When does Spring create a proxy ⭐⭐⭐
15 What is AOP Aspect-Oriented Programming ⭐⭐⭐
16 What is aspect advice pointcut join point ⭐⭐⭐
17 What does the Transactional annotation do ⭐⭐⭐
18 Why Transactional does not work with self-invocation ⭐⭐⭐
19 How to solve the self-invocation problem ⭐⭐⭐
20 What is auto-configuration in Spring Boot ⭐⭐⭐
21 How SpringBootApplication works ⭐⭐⭐
22 What is a starter in Spring Boot ⭐⭐
23 What does the ComponentScan annotation do ⭐⭐⭐
24 What is a Configuration class ⭐⭐⭐
25 Difference between Component Service Repository Controller ⭐⭐
26 What does the Autowired annotation do ⭐⭐
27 What to do if there are multiple beans of the same type ⭐⭐
28 What is Qualifier ⭐⭐
29 What are profiles in Spring ⭐⭐

🗺️ Topic Dependency Map

                    ┌──────────────────────────────────────────┐
                    │   DI & IOC FOUNDATIONS (01-03)           │
                    │   01. Dependency Injection               │
                    │   02. Constructor vs Setter vs Field     │
                    │   03. Injection Best Practices           │
                    └──────────────────┬───────────────────────┘
                                       │
            ┌──────────────────────────┼──────────────────────────┐
            ▼                          ▼                          ▼
    ┌───────────────┐        ┌───────────────┐        ┌────────────────────┐
    │ BEAN CONCEPT  │        │ BEAN LIFECYCLE│        │ BEAN SCOPES        │
    │ (04-05)       │        │ (06-09)       │        │ (10-12)            │
    │ 04. Bean      │        │ 06. Lifecycle │        │ 10. Scope concept  │
    │ 05. Creation  │        │ 07. 12 steps  │        │ 11. Scope types    │
    │               │        │ 08. BPP       │        │ 12. Singleton vs   │
    │               │        │ 09. @PostCon/ │        │     Prototype      │
    │               │        │    @PreDest   │        │                    │
    └───────┬───────┘        └───────┬───────┘        └────────┬───────────┘
            │                        │                        │
            └────────────────────────┼────────────────────────┘
                                     ▼
                    ┌──────────────────────────────────────────┐
                    │   DYNAMIC PROXY & AOP (13-19)            │
                    │   13. Dynamic Proxies (CGLIB / JDK)      │
                    │   14. When Spring Creates Proxies        │
                    │   15. AOP Fundamentals                   │
                    │   16. Advice, Pointcut, JoinPoint        │
                    │   17. @Transactional Internals           │
                    │   18-19. Self-Invocation Problem & Fixes │
                    └──────────────────────────────────────────┘
                                     │
            ┌────────────────────────┼────────────────────────┐
            ▼                        ▼                        ▼
    ┌───────────────┐        ┌───────────────┐        ┌────────────────────┐
    │ SPRING BOOT   │        │ CONFIG & SCAN │        │ STEREOTYPES & DI   │
    │ (20-22)       │        │ (23-24)       │        │ (25-29)            │
    │ 20. Auto-conf │        │ 23. @CompScan │        │ 25. Stereotypes    │
    │ 21. @BootApp  │        │ 24. @Config   │        │ 26. @Autowired     │
    │ 22. Starters  │        │     Full/Lite │        │ 27. Multiple Beans │
    │               │        │               │        │ 28. @Qualifier     │
    │               │        │               │        │ 29. Spring Profiles│
    └───────────────┘        └───────────────┘        └────────────────────┘

🟢 Junior Level Track (Core Fundamentals)

  1. DI & Injection: Q01, Q02, Q03 (Inversion of Control, constructor vs field injection).
  2. Bean Basics: Q04, Q05 (@Component, @Bean, ApplicationContext).
  3. Scopes & Stereotypes: Q10, Q12, Q25, Q26 (Singleton vs Prototype, @Service, @Repository, @Autowired).
  4. Spring Boot Starters: Q20, Q22 (Autoconfiguration concepts, starter BOMs).

🟡 Middle Level Track (Internals & Production Mechanics)

  1. Lifecycle & Hooks: Q06, Q07, Q08, Q09 (BeanPostProcessor, @PostConstruct, @PreDestroy).
  2. Web Scopes: Q11 (request, session, application scoped proxies).
  3. Proxy Engine: Q13, Q14 (CGLIB subclassing vs JDK dynamic interface proxies).
  4. Transactions & Self-Invocation: Q17, Q18, Q19 (@Transactional rollback rules, proxy bypassing, 4 solutions).
  5. Boot Composition: Q21, Q27, Q28, Q29 (@SpringBootApplication, @Primary, @Qualifier, @Profile).

🔴 Senior Level Track (Architecture & Deep Internals)

  1. AOP Weaving & Interception: Q15, Q16 (Spring AOP runtime proxying vs AspectJ compile-time weaving).
  2. Autoconfiguration Engine: Q20, Q23 (@ConditionalOn*, AutoConfiguration.imports vs spring.factories).
  3. Configuration Modes: Q24 (@Configuration(proxyBeanMethods = true) Full CGLIB mode vs Lite mode).
  4. Circular Dependency Engine: Q07 (3-level cache: singletonObjects, earlySingletonObjects, singletonFactories).