Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent a Java EE app from starting when Spring DI fails

(I'm not sure if this question applies to Java EE apps in general or is Websphere-specific.)

When we get a Spring DI failure on apps we've deployed to WebSphere (a JNDI lookup failure, for example) the application still appears to have started successfully.

[15/02/11 17:21:22:495 GMT] 00000037 ContextLoader E org.springframework.web.context.ContextLoader initWebApplicationContext Context initialization failed
                                 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mybean' defined in
   ...big stack trace...
[15/02/11 17:21:22:526 GMT] 00000037 ApplicationMg A   WSVR0221I: Application started: myapp

How can I make the application fail to start if exceptions are thrown during the spring initialisation?

like image 889
brabster Avatar asked Nov 06 '22 02:11

brabster


1 Answers

Check if this helps. Based on that I'd guess it's application server-specific, but not sure.

like image 84
esaj Avatar answered Nov 09 '22 02:11

esaj