My ApplicationContext has beans that are autowired as well as beans that are configured in application-Context.xml file. I want to know the sequence of bean initialization by spring.
I wanted to know this because: (I know this is a known and popular issue in stackoveflow..but could not get a solution!!) I have created SessionBean in application-Context.xml. Now tring to autowire this bean in DaoImpl file. sessionBean is showing null there. May be its sessionFactory is not initialised till then.
*I have tried using @DependsOn("SessionFactory") with failure.
So my questions are:
1)How to find the sequence of beans initialised by spring.
2)How do say to spring to initilise sessionfactory before initialising my DAOImpl class.
Please help as i am struck!!
Thanks in advance.
Spring auto determines the sequence of Bean initialization by looking at if all the dependencies of the said bean are initialized or not.
Your case seems like you are not using the spring initialized bean of DaoImpl class whereas creating a new Object of the class on you own.
Try creating the bean of the DaoImpl class and use the bean.