Currently, the handleTypeMismatch method in ResponseEntityExceptionHandler does not include information about the required type in its error message.
I’d like to extend this handler so that the response includes the expected type information when a TypeMismatchException occurs. This would make debugging and client error handling easier, as users could immediately see which type was expected.
https://github.com/spring-projects/spring-framework/blob/main/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java#L484
e.g.
String defaultDetail = "Failed to convert '" + args[0] + "' with value: '" + args[1] + "'";
final Class<?> requiredType = e.getRequiredType();
if ( requiredType != null ) {
String defaultDetail = "Failed to convert '" + args[0] + "' with value: '" + args[1] + "' to be a valid " + requiredType.getSimpleName();
}