DIR Return Create A Forum - Home
---------------------------------------------------------
Java
HTML https://java.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: General Discussion
*****************************************************
#Post#: 2--------------------------------------------------
Dependency Injection (DI) &&Spring Core Container and Be
ans
By: shekar Date: August 23, 2014, 5:09 am
---------------------------------------------------------
The process of injecting (pushing) the dependencies into an
object is known as Dependency Injection (DI).
This gives some benefits as described below.
i. The application development will become faster.
ii. Dependency will be reduced.
Spring Core Container and Beans:
Spring core container is the basis for the complete Spring
Framework.
It provides an implementation for IoC supporting dependency
injection.
The Spring core container takes the configurations to understand
the bean objects that it has to instantiate and manage the
lifecycle.
The one important feature of the Spring core container is that
it does not force the user to have any one format of
configurations, as most of the framework which are designed to
have XML based or Property file base configuration, or
programmatically using the Spring beans API. But in most of the
cases we use XML based configurations since they are simple and
easy to modify.
The org.springframework.beans.factory.BeanFactory is the actual
representation of the Spring IoC container that is responsible
for containing and otherwise managing the aforementioned beans.
The BeanFactory interface is the central IoC container interface
in Spring. Its responsibilities include instantiating or
sourcing application objects, configuring such objects, and
assembling the dependencies between these objects.
The most commonly used BeanFactory implementation is the
XmlBeanFactory class. This implementation allows you to express
the objects that compose your application, and the doubtless
rich interdependencies between such objects, in terms of XML.
The XmlBeanFactory takes this XML
configuration metadata and uses it to create a fully configured
system or application.
The Spring IoC container consumes some form of configuration
metadata; this configuration metadata is nothing more than how
you (as an application developer) inform the Spring container as
to how to “instantiate, configure, and assemble [the objects in
your application This configuration metadata is typically
supplied in a simple and intuitive XML format.When using
XML-based configuration metadata, you write bean definitions for
those beans that you want the Spring IoC container to manage,
and then let the container do it's stuff.
Spring configuration consists of at least one bean definition
that the container must manage, but typically there will be more
than one bean definition. When using XMLbased configuration
metadata, these beans are configured as <bean/> elements inside
a top-level <beans/> element.
*****************************************************