Spring Fundamentals
5 Topics
1
What is the Spring Framework? IoC Container Explained
An introduction to Spring, the Inversion of Control paradigm, and the role of the BeanFactory/ApplicationContext.
A foundational concept that is tested in almost every Java/Spring backend interview to check if you understand how Spring manages object lifecycles.
2
Dependency Injection — Constructor vs Field vs Setter
Compare injection strategies and understand why constructor injection is preferred in production.
Interviews frequently drill down on why constructor injection is preferred over field/setter injection, focusing on immutability, circular dependencies, and testability.
3
Bean Lifecycle — How Spring Creates and Destroys Beans
The complete lifecycle phases: instantiation, populating properties, aware interfaces, post-processors, and destruction.
Crucial for understanding how to hook custom init/destroy logic, how bean post-processors intercept beans, and resolving initialization order issues.
4
Spring Application Context — The Heart of Spring
Exploring the ApplicationContext interface, configuration sources, and runtime environment abstractions.
Questions often test how Spring boots up, how ApplicationContext loads configuration, how to access the context programmatically, and how active profiles are fetched.
5
Component Scanning and Stereotype Annotations (@Component, @Service, @Repository)
How Spring performs classpath scanning and filters component configurations.
Very common to be asked about the differences between @Component, @Service, @Repository, @Controller, and how component scanning can be customized or configured.