Spring Framework Basics Flashcards

1
Q

What is the Spring Framework?

A

A comprehensive Java framework for enterprise applications providing support for dependency injection, AOP, and more.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is Dependency Injection (DI) in Spring?

A

A design pattern where the framework provides the dependencies required by a class instead of the class creating them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Name the core container modules in Spring Framework.

A

Spring Core, Spring Beans, Spring Context, and Spring Expression Language (SpEL).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the role of the Spring BeanFactory?

A

The BeanFactory is a factory class in Spring to manage the lifecycle and configurations of beans.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the ApplicationContext in Spring?

A

A more advanced container than BeanFactory that supports enterprise-specific features like event propagation and declarative mechanisms.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How does Spring enable inversion of control (IoC)?

A

Through Dependency Injection, where objects are created externally and injected into the dependent classes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a Spring Bean?

A

An object that is instantiated, assembled, and managed by the Spring IoC container.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you define a bean in Spring using annotations?

A

By using the @Component, @Service, @Repository, or @Controller annotations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the purpose of the @Autowired annotation?

A

To automatically inject dependencies into a bean by type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you configure a Spring bean using XML?

A

By defining <bean> elements inside an XML configuration file.</bean>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly