All in all, two bean lifecycle methods are there.
The first method is the setup method which is called during the loading of the bean into the container. The second is when the bean is unloaded from the container, and this method is called the teardown.
https://www.geeksforgeeks.org/bean-life-cycle-in-java-spring/