This video explains the destruction phase of the Spring Lifecycle.
- [Instructor] When an application…is in the end of its lifecycle,…it goes through a destruction phase.…The destruction phase in a Spring application begins…when close is called on the application context.…Now, this can either be a manual call to close…or when the framework in which the application itself…is running calls close.…As the application context itself is starting to close,…any method that is annotated with @PreDestroy…or the corresponding XML notation for a PreDestroy method,…that method itself is executed at that point.…
An important thing to note is that the beans themselves…are not destroyed at this point.…In a Java world,…the only thing that can destroy a class itself…is the garbage collector…so calling close on the application context…makes every bean contained within it go out of scope…and allow it to be garbage collected…during the normal processing.…There's a couple caveats…when dealing with the destruction phase…of a Spring application.…One is that the application context itself…cannot be reused again.…
AuthorFrank P Moley III
- Introduction to Spring
- Configuring the ApplicationContext
- Using the Spring expression language
- Configuring proxies
- Autowiring beans
- Using lifecycle methods
- Configuring beans with XML
- Understanding the initialization phases of the bean lifecycle
- Aspect-oriented programming and Spring
Skill Level Intermediate
Learning Spring with Spring Bootwith Frank P Moley III1h 38m Intermediate
1. Spring Overview
2. Configuring the Application Context
3. Annotation-Based Configuration
4. XML-Based Configuration
5. Bean Lifecycle
6. Aspect Oriented Programming
Next steps2m 10s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.