In the context of Spring Framework, if we want to execute some code after the bean construction, then we can write that code inside the custom init() method. Similarly, if we want to execute some code just before the destruction of the bean, we can write that code inside destroy() method. These methods are called Spring Bean Life Cycle Methods. Here in this article we will develop 'Spring Bean Life Cycle Method Examples'. The bean life cycle is managed by the spring container. When we run the program, first of all, the spring container gets started. After that, the container creates the instance of a bean as per the request, and then the required dependencies are injected. At the end, the bean
You are here
Home > Posts tagged "life cycle of bean in spring"