Posts

Showing posts from February, 2013

Spring 3 Prart 4: Lifecycle Management

Image
This is the 4th part of the Spring 3 Series . Regardless of bean scope, initialization lifecycle callback methods are called on objects in Spring. There are 3 ways to achieve this interface based method based annotation based Depend on your application requirements, you need to evaluate which mechanism is best. To achieve more portability third is the best because it is based on the JSR-250. If you are not concern of portability and in an application and needs lifecycle notification for many beans of the same type, then best is interface mechanism. When you share the bean among multiple spring projects , then interface mechanism is the best because interface mechanism based beans are self-contained. Above diagram shows a high-level overview of how Spring manages the life cycle of the beans within its container(Harrop, Rob; Ho, Clarence (2012-04-18). Pro Spring 3 (Professional Apress) (p. 115). Apress. Kindle Edition). It is important to remember that initializat