You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spring Initialzation and Destruction lifecycle callbacks example
How is it configured in example
Custom Service implements InitializingBean, DisposableBean to define afterPropertiesSet() and destroy() methods for respective interfaces. It also has @PostConstruct and @PreDestroy methods
In application class, customService2 Bean is defined with configuration providing init-method and destroy-methods.
Running the application shows the sequence in which methods are called
Importing and running project
Import project as Maven project
Run application as Spring Boot Application
Observe log to see the sequence of execution
About
Example of Initialization and destruction lifecycle callbacks