alexs333
alexs333

Reputation: 12563

Spring - complete shutdown of web application

I have a web application which I'm trying to shut down by executing the close() method on the context:

((ConfigurableApplicationContext) appContext).close();

After executing this the application appears to be continuing running, health page produces the following exception:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)

Is there a way to shudown the whole thing via Spring or should I resort to System.exit()?

Any help would be kindly appreciated!

Upvotes: 5

Views: 1109

Answers (0)

Related Questions