Dec 4th, 2009, 04:47 PM
How to stop Spring container mid-way in its start programmatically
I may want to programmatically shut down the spring container e.g. mid-way, if a certain condition is raised. I do not want code as System.exit(1) as it will terminate the entire JVM and more than 1 applivation is running in the JVM. My goal is to shut down only one application (among more than one) that is running in the same shared JVM.
I was thinking that throwing a RuntimeException will stop the Spring based application from starting. But that is not true. The runtime exception was thrown, but that did not stop the application from starting.
Is there a way to stop the application from starting, if a certain condition is raised?
Again, not coding as System.exit(1) that would trigger shutdownhook.
Would like to find a solution for both stand-alone and web-based application.
I am using WebSphere 6.1 as application server.
Last edited by sunfun; Dec 4th, 2009 at 04:51 PM.
Reason: more info