Spring Core Flashcards

(10 cards)

1
Q

DI

A

Dependency Inversion: A design pattern that provides for loose coupling; it uses service components, consumer classes, and injector classes.

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

Service components

A

interface/abstract class that define a contract for services

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

Consumer class

A

written in terms of service interface

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

What is Spring?

A

Spring is an open-source framework that sits on top of Java; series of JAR files (dependencies to add to Maven); provides an abstract layer to some of more complex parts of Java; Spring helps structure whole applications in a consistent, productive manner, encouraging SOLID design

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

What are the benefits of Spring?

A

Lightweight - about 2 MB; IoC (Inversion of Control) - loose coupling; Spring Container: Spring contains and manages lifecycle of objects; Boilerplate code - Spring provides templates which allow you to reduce amount of boilerplate code.

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

Spring Core Container

A

Spring container is the core of Spring Framework, responsible for creating and configuring the objects needed for an application, managing complete lifecycle for creation/destruction of objects; uses DI to wire objects together; these objects are called Spring Beans

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

ApplicationContext

A

Interface used to represent the Spring IoC container and therefore load up the configuration

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

@Component Annotation

A

@Component tells Spring: “Create an instance of this class and manage it as a bean in the ApplicationContext.”

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

@Autowired Annotation

A

@Autowired tells Spring: “Inject a bean of the required type here.” Spring looks in the ApplicationContext, finds a matching bean, and injects it.

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

IoC

A

Inversion of Control: It is responsible for creating, managing, and configuring application objects (beans). Using Dependency Injection:

Automatically injects required dependencies into beans.
Manages bean creation, initialization, and destruction.
Supports XML, annotation-based, and Java-based configuration.
Separates object creation from business logic, making applications more flexible and testable.

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