Sometimes, the bean class may need to get information about the factory that loaded it. If the bean class implements BeanFactoryAware, its setBeanFactory() method gets invoked, and passes the instance of BeanFactory to it, which may be an instance of ApplicationContext, WebApplicationContext, and so on.