Currently i am trying to build up a spring based application, where in the cases of any exceptions/errors being thrown while intialization of the context, the application itself should be brought down.
1. creating a appContext.xml where DBs are being initialized.
2. Cases where db isn't getting initialized since the context couldn't be initialized completely, we will get Servlet.init() error.
3. I want to intercept in between these two steps, where the application itself should be brought down, in case of any errors
I have tried the following:
1. Using the error location handler in web.xml, creating a json stating that some error had occured. But this is not pre emptive, as in the application will keep on running.
2. Using events hook provided by spring, but there are only five of these: context start/stop/refresh/close/request handling. I have tried exploring custom events being raised, but I don't know where/how to publish/subscrive to these events.