After I call the close method on context variable (of type ClassPathXmlApplicationContext), spring calls the destoy-method (doMyCleanupStuff in my case).
context