Sie können Ausnahmen mit Spring AOP, @Aspect
behandeln public class ErrorInterceptor{
@AfterThrowing(pointcut = "execution(* your.package..* (..))", throwing = "ex")
public void errorInterceptorForSerializationException(SerializationException ex) {
// DO SOMETHING HERE WITH EX
logger.error( ex.getCause().getMessage());
}
@AfterThrowing(pointcut = "execution(* your.package..* (..))", throwing = "ex")
public void errorInterceptorForSerializationFailedException(SerializationFailedException ex) {
// DO SOMETHING HERE WITH EX
logger.error( ex.getCause().getMessage());
}
}