Search This Blog

Sunday, 29 April 2012

Bean Creation via Factory Method

The Spring Container does not have to instantiate beans via using the new keyword. Some times objects are created from factories. There are two ways to achieve the same - via a static factory method or via an instance factory method.

Thursday, 26 April 2012

Using BeanPostProcessors

Spring provides us with BeanPostProcessor classes that can be used to process beans before and after they have been configured by the container.

Tuesday, 24 April 2012

Creating default init and destroy methods

In earlier post we saw how Spring allowed us to define custom init and destroy methods - both via configuration and via code.As we are working with cars, we will need to check the engine on all cars before use and clean the car after use.

Monday, 23 April 2012

The InitializingBean and DisposableBean Interfaces

In our previous post we saw how the Spring container used custom initialization and destroy methods. An alternative way to achieve the same is to use the InitializingBean and DisposableBean Interfaces.

Saturday, 21 April 2012

Custom Bean Initialization and Destroy Methods

It is possible that we may need to execute some initialization code when the bean has been initialized successfully by the Spring Container. We saw that the bean life cycle has several methods that can be used to initialize our bean.