Annotation-based configuration
@ExceptionMapping(exceptionType = IllegalAccessException.class, status = 403)
@ExceptionMapping(exceptionType = NullPointerException.class, status = 500, message = "NullPointerException was thrown.")
@ExceptionMapping(exceptionType = RuntimeException.class, status = 500, useExceptionMessage = true)
XML-based configuration
<exceptions:Mapping exceptionType="java.lang.StringIndexOutOfBoundsException" statusCode="500"/>
<exceptions:Mapping exceptionType="java.lang.ArrayIndexOutOfBoundsException" statusCode="500" message="ArrayIndexOutOfBoundsException was thrown."/>
<exceptions:Mapping exceptionType="java.lang.IndexOutOfBoundsException" statusCode="500" message="An exception was thrown. The date is: #{date}"/>
Programmatic exception handling
ArithmeticException