From the course: Spring: Framework in Depth

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Lifecycle methods

Lifecycle methods

From the course: Spring: Framework in Depth

Start my 1-month free trial

Lifecycle methods

[Instructor] - Sometimes you have behavior, that you need to perform within a class, that requires the dependency injection to be completed, but this behavior either needs to be done before the application is ready for use, or right before it's destroyed. Enter into the picture, Lifecycle Methods. While Spring is Starting up, the system itself is not usable and this can, occur in the same way during shut down. Spring proxies are not always available during object instantiation, or after destruction has started. This means that not everything is available from a spring perspective, including the framework itself during the construction of an application that you may need behavior-wise in order to perform some task. This will also again apply during the destruction phase as you have no control over the order of garbage collection and you need a way to do some work before Spring goes out of scope. One thing to note…

Contents