Add native support for @ExceptionHandler

This commit makes sure that `@ExceptionHandler`-annotated methods can be
invoked via reflection in a native image. As most of the handling of
the parameter and the return type is shared with our generic
RequestMapping handling, the ReflectiveProcessor extends from it.

An `@ExceptionHandler`-annotated method can return a `ProblemDetail`. If
that's the case, reflection entries are contributed.

Closes gh-29297
This commit is contained in:
Stephane Nicoll
2022-10-11 09:37:02 +02:00
parent c94b676576
commit 45939720f2
5 changed files with 78 additions and 32 deletions

View File

@@ -28,13 +28,13 @@ import org.springframework.http.HttpEntity;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link RequestMappingReflectiveProcessor}.
* Tests for {@link ControllerMappingReflectiveProcessor}.
*
* @author Sebastien Deleuze
*/
public class RequestMappingReflectiveProcessorTests {
public class ControllerMappingReflectiveProcessorTests {
private final RequestMappingReflectiveProcessor processor = new RequestMappingReflectiveProcessor();
private final ControllerMappingReflectiveProcessor processor = new ControllerMappingReflectiveProcessor();
private final ReflectionHints hints = new ReflectionHints();