This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi. I want to create an application scope variable on startup of my web app. However the variable will contain data from the database. My app interacts with the database via injecting a sessionFactory bean into my daoimpl classes (which extend HibernateDaoSupport). My question is does the application listener execute prior to the spring container load up. I am guessing the answer is yes, in which case how do I go about this issue?
No, it isn't; beans can simply implement <tt>ApplicationListener</tt> and pay attention to <tt>ContextRefreshedEvent</tt>s. Context refresh events signal that the context is available, hence all beans etc. are ready to be used. This has the added advantage of handling *all* context refresh events, regardless of why the event too place.