Following this tutorial, working with complete code, how do I enable exception translation for mongo?
When my mongo db is down, i'm getting 500 error from com.mongodb.MongoServerSelectionException
. Shouldn't this be translated into DataAccessResourceFailureException
with MongoExceptionTranslator? Am i supposed to register this bean somehow? I've tried with:
@Bean
public MongoExceptionTranslator mongoExceptionTranslator() {
return new MongoExceptionTranslator();
}
but still no change
EDIT:
I've created a demo with the suggestions from Stackee007 but still can't get this to work