0% found this document useful (0 votes)
3 views2 pages

Spring core

Uploaded by

gokulpradeep1908
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Spring core

Uploaded by

gokulpradeep1908
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

3:48 PM 22/10/2024

spring container :

1.Spring container is the core concept in spring core.


2.It is used to managing the life cycle and configuration Spring bean class.
3.It initialize the bean class into the spring container and using dependency
injection we can inject the bean object into the target object.

There are two types of spring container :

1.Bean Factory(Lazy Initialization).


2.Application Context(Eager Initialization).

1. Bean Factory: It is one of the container in Spring .It is used to initialize the
bean in this Container .It is known as LAZY initialization. (It is not initialize
the bean in Start up spring.
When the bean is used or called then the bean is initialized in Bean factory).
Using @Lazy annotation we can perform lazy initialization.

2.Application Context: It is another container in Spring and it is the latest using


container . This container initialize the bean when the Spring context object is
created .It is known as
EAGER initialization. (it means ,when the Spring context object is created in the
Start up Spring .then it initialize the bean in application Context Container. It
is Known as Eager initialization).

@SpringBootApplication:

It is the parent annotation in spring boot and it is also used as


Stereo type annotation (means we can use this annotation only in class level) .It
is only denoted in main class.
there are three type important annotation inside the @SpringBootApplication .

1. @SpringBootConfiguration.
2. @EnableAutoConfiguration.
3. @ComponentScan.

1. @SpringBootConfiguration.

It is used to configure the spring classes automatically like configure


the Bean classes in Spring Container(Inversion Of Control container).

2.@EnableAutoConfiguration.

It is used to configure the classes automatically in the Specified


class path using dependency injection .We don't need to write a manual
configuration in XML file externally.

3.@ComponentScan.

It is used to read the bean classes which is inside the main packages
and their sub packages. It is don't need other packages bean class Automatically so
we need to
override the @componentScan annotation in our class.

Spring Core Annotation:


1.@Component:

This annotation help to create object for bean classes (without using
new keyword).That object is Stored inside the spring container or IOC container .By
default the scope of the
object is Singleton we need more than one object for the class we have to change
scope of the object using @Scope("prototype").

2.@Autowired:

This annotation is used to inject the dependent object get from the IOC
container then inject into the target object.

3.@Qualifier:

By default @Autowired annotation check the object based on its type.


But we need to check the object in IOC container based on specified with name .

You might also like