Spring Framework Basics Flashcards
What is the Spring Framework?
A comprehensive Java framework for enterprise applications providing support for dependency injection, AOP, and more.
What is Dependency Injection (DI) in Spring?
A design pattern where the framework provides the dependencies required by a class instead of the class creating them.
Name the core container modules in Spring Framework.
Spring Core, Spring Beans, Spring Context, and Spring Expression Language (SpEL).
What is the role of the Spring BeanFactory?
The BeanFactory is a factory class in Spring to manage the lifecycle and configurations of beans.
What is the ApplicationContext in Spring?
A more advanced container than BeanFactory that supports enterprise-specific features like event propagation and declarative mechanisms.
How does Spring enable inversion of control (IoC)?
Through Dependency Injection, where objects are created externally and injected into the dependent classes.
What is a Spring Bean?
An object that is instantiated, assembled, and managed by the Spring IoC container.
How do you define a bean in Spring using annotations?
By using the @Component, @Service, @Repository, or @Controller annotations.
What is the purpose of the @Autowired annotation?
To automatically inject dependencies into a bean by type.
How do you configure a Spring bean using XML?
By defining <bean> elements inside an XML configuration file.</bean>