Organizational Research By

Surprising Reserch Topic

graceful handling of exception thrown while creating beans

graceful handling of exception thrown while creating beans  using -'spring,exception-handling'

I want my Spring MVC web app to gracefully handle a particular type of exception thrown while creating the beans.

The construction of one of my beans reads configuration data from an external file. If that configuration data is faulty, one of my bean constructors will throw an exception of a particular type. As the cause of the problem would be a faulty configuration file, I want my web application to respond with a useful log message and/or an error page, rather than a stack-trace of the thrown exception. So I guess I need some kind of exception handler hooked into the IOC container or dispatcher servlet. How can I do that?

Just to be clear. I'm asking about exceptions thrown as the servlet is initialising, not as it handles HTTP requests, so @ExceptionHandler annotations on controllers are not useful.

asked Oct 7, 2015 by jekbishnoi
0 votes

Related Hot Questions

1 Answer

0 votes
answered Oct 7, 2015 by param.oncemore