In a spring MVC application, I initialize a variable in one of the service classes using the following approach:
ApplicationContext context = new C
import org.springframework.context.ConfigurableApplicationContext; ((ConfigurableApplicationContext)ctx).close();