Examining life cycle messages
We read about the bean's life cycle; why don't we try to examine the life cycle?
Modify the HelloWorld
class and implement the following Spring Framework interfaces:
ApplicationContextAware
: This will ask you to implement thesetApplicationContext
methodBeanNameAware
: This will tell you to implement thesetBeanName
methodInitializingBean
: This will force you to implement theafterPropertiesSet()
methodBeanFactoryAware
: This will request you to implement thesetBeanFactory
methodBeanPostProcessor
: This needs you to implement thepostProcessBeforeInitialization
andpostProcessAfterInitialization
methodsDisposableBean
: This needs to implement thedestroy()
method
Add the System.out.println
statement in all the implemented ...
Get Mockito for Spring now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.