Introduction
to Spring container
1.
IoC –
Inversion of Control is also known as Dependent Injection.
2.
IoC is a
process where objects define their dependencies through
a.
Constructor
arguments – Constructor Injection
b.
Arguments
to a factory method – Method Injection
c.
Properties
to setter methods – Setter Injection
d.
Interface
Injection
e.
Lookup
method Injection
3.
The IoC
container injects those dependencies when it creates bean.
4.
This
process is fundamentally called as Inverse, hence the name is Inversion
of Control.
5.
Spring
container itself controlling the instantiation and location of its dependencies
by using direct constructor classes or a mechanism such as Service Locator pattern.
a.
org.springframework.beans.*
b.
org.springframework.context.*
7.
Basic
Spring IoC containers are
a.
org.springframework.beans.factory.BeanFactory (Interface)
b.
org.springframework.beans.factory.ApplicationContext (Interface)
8.
The objects
that are formed/created and managed by spring container are called as Spring
beans.
9.
BeanFactory vs
ApplicationContext
BeanFactory
|
ApplicationContext
|
1. Root interface for
accessing spring bean container.
|
1. Child interface of
BeanFactory interface
|
2. It provides configuration
framework .
|
2. It provides more enterprise
specific functionality.
|
3. It provides basic
functionality.
|
3. It adds integration with
AOP features, message resource handling (I18N), event publications.
|
4. Some Implementation classes
are
1.
XmlBeanFactory
2.
DefaultListableBeanFactory
3.
SimpleJndiBeanFactory
4.
StaticListableBeanFactory
|
4. Implementation classes are
1.
XmlApplicationContext
2.
FileSystemXmlApplicationContext
3.
ClassPathXmlApplicationContext
4.
AnnotationConfigWebApplicationContext
|
No comments:
Post a Comment