Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

How will spring ioc container work?

user-image
Question added by bibek nayak
Date Posted: 2016/11/22
sunil thota
by sunil thota , Jr Java Developer , N-Axes Technologies

Spring ioc container work based on dependency injection.

Class is one type of DataType we use this class datatype in our class to call the appropriate methods to complete the task.In jenerally we create the class object and supplay to that class but in spring we configure in bean xml file.It create automatically by container and supplay to that class.

We create a bean class object it will not have any lifecycle states but spring container create the bean class object it have lifecyle states.We control the connections of databse based on that lifecyle process.

Containers manages the whole life cycle of the objects,Spring basically have 3 kinds of container i.e., Core container(Bean Factory),Advance Container(Application Context),Web Container(finds applicability in MVC frameworks).So container manages,wires,services all the dependencies which bean class do have.

pratik kumar
by pratik kumar , SBR Softtech Pvt Ltd

The Spring IoC creates the objects, wire them together, configure them, and manage their complete lifecycle from creation till destruction.

The Spring container uses dependency injection (DI) to manage the components that make up an application.

The BeanFactory and ApplicationContext interface are the two types of conatiner. A BeanFactory just initiates and configures beans. An ApplicationContext also does that, and also provides more supporting infrastructure likesimple integration with Spring's AOP, message resource handling (for I18N), event propagation.

Example - 

ApplicationContext context =  new ClassPathXmlApplicationContext("applicationContext.xml");  

where , applicationContext.xml is the config file where beans has been decalred.

Widad Abboudi
by Widad Abboudi , Ingénieur d'étude et développement Java Jee , SPLIMS MAROC

The Spring container provides the IoC principle through two packages - org.springframework.beans and org.springframework.context. The BeanFactory and ApplicationContext interface are the two available options. A BeanFactory just initiates and configures beans. An ApplicationContext also does that, and also provides more supporting infrastructure that enables lots of enterprise specific features such as Aspect Oriented Programming and transaction. 

More Questions Like This