© Joseph B. Ottinger and Andrew Lombardi 2019
J. B. Ottinger, A. LombardiBeginning Spring 5https://doi.org/10.1007/978-1-4842-4486-9_4

4. Lifecycle

Joseph B. Ottinger1  and Andrew Lombardi2
(1)
YOUNGSVILLE, NC, USA
(2)
Laguna Beach, CA, USA
 

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 ...

Get Beginning Spring 5: From Novice to Professional now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.