Sorry for bringing back to life such an old thread, but I've got a small question. In my app I'm doing pretty much what you suggested:
Code:
public class ManagerApp {
public static void main(String[] args) {
AbstractApplicationContext appContext = new ClassPathXmlApplicationContext(new String[]{"manager-context.xml", "dao-context.xml"});
CompanyDao dao = (CompanyDao) appContext.getBean("companyDao");
List<Company> companies = dao.getCompanies();
System.out.println("company count: " + companies.size());
appContext.registerShutdownHook();
System.out.println("END");
}
}
but somehow the app keeps running after printing "END".
From what I see, this is related to the fact that in my application context I've got an org.springframework.scheduling.quartz.SchedulerFac toryBean running some threads periodically...
How can I shut it all down?
Thanks and best regards,
Peter