Tuesday, September 26, 2017

life cycle of Spring object creation



The lifecycle of object creation is
- As soon as we request beanfactoy.getBean("h2"), spring container instantiates bean with default / no arg constructor (in setter injection) or parameterized constructor during constructor injection)
-If setter injection is required set method(s) are called on bean instance
-User defined init-method
-and then gives bean ref to client
-as soon as client requests on bean methods are completed, before garbage collecting bean instance container invokes user defined destroy-method


No comments: