Spring Bean lifecycle events – method based

In this method we can define a method as initialization method so that Spring can call that method once setting all properies and checking the dependencies

I am creating init() method inside the Car bean

Now you have to add init-method attaribute to the bean tag and set the value as name of the method init

How do you fire the event when your bean is destroyed

You can simply add mthod to your Bean and update your bean.xml

Now you can see the following output: