JEE - Spring - Spring Boot 3 Flashcards

1
Q

What is Spring ?

A

Spring is a Java Framework. Its core feature is IoC and DI.
______________________________________________
IoC=>Spring manages objects in Java instead of Programmer
DI=>manages objects dependencies allowing objects to be loosely coupled

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

What is IoC ?

A

IoC is a principle that consist on delegating reponsibility of creating and managing an object to an external container or framework ( ex : Spring’s IoC Container )

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

What is Dependency Injection (DI)?

A

DI is a specific design pattern used on implementing IoC , which consist on injectiong required dependencies on object instead of the object creating them itself.
this is done at runtime , either through constructor injection , setter injection or field injection ( annotation @Autowired )

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

What is difference between IoC and DI ?

A

DI is a specific design pattern used on implementing IoC

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

What is Beans in Spring ?

A

Bean is a java object, they can be created using xml configuartion ( in applicationContext.xml ) , annotations or java-based configuration.

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

What are Types of Beans / scopes ?

A

*Singleton Bean : By default , Spring beans are Singleton , meaning only one instance of bean is created per Spring container. Every time you request a bean from the container , the same instance is returned.
*Prototype Bean : A prototype beans mean a new instance is created every time it is requested.
*Other scopes : request , session , global-session in web applications

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

Beans Lifecycle management ?

A

Initializing and destruction of beans is managed by annotations @PostConstruct and @PreDestroy

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

Bean names ?

A

Each bean can be identified by a unique name defined in Spring Container

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

What is Context in Spring ?

A

It refers to Spring ApplicationContext which servers as main interface to access beans in Spring Container ( it is a more advanced version of BeanFactory )
It is where the Spring Container is initialized and it is responsible for managing complete lifecycle of beans.

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

Example of bean definition in xml configuration file :

A

<bean>
<property></property>
</bean>

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

What is Spring Boot ?

A

Spring Boot is an extension of Spring Framework that simplify development of Spring applications by reducing configuration complexity and speeding up development.

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

What is difference between Spring and Spring Boot ?

A

Spring Boot provides auto-configuration , embedded servers, and production-ready features for quick development ( especially microservices ), while Spring provides more flexibility and customization but requires more manual configurations and setups.
=> Use Spring Boot for quick standalone apps , and Spring to have a full control over application configuartions.

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

What are Common annotations of Spring Boot ?

A

view word doc

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

Other resource for interview JAVA/JEE :

A

https://github.com/ouhamzalhss

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