title: Best way to force Spring shutdown from a bean?
body: <p>My application uses a Spring <code>DefaultMessageListenerContainer</code> to process incoming messages. The main method of the app already registers a shutdown hook.</p>
  
  <p>Question is this: what is the best way to force the application context to shut down?</p>
  
  <p>If I throw a <code>RuntimeException</code> in the message listener, it is handled by the container, and not passed on. Is calling System.exit acceptable? Do I pass along the <code>ApplicationContext</code> to every class that needs to shut down, so I can call <code>close()</code> on it?</p>