In this chapter, we’ll expand on our sample application and learn about the lifecycle options in Spring. We’ll introduce how to invoke methods when Spring beans are created or destroyed and how to do so via multiple configurable options either using the Spring XML file, annotations, or the programmatic configurations, all of which were used in Chapter 3.
4.1 Introduction of Lifecycle
Every object has a lifecycle in the Java Virtual Machine. When an object is created, it’s got a series of initialization stages (at the ...