@@ -74,6 +74,24 @@ void registerReflectiveHintsForMethodWithRequestBody() throws NoSuchMethodExcept
74
74
typeHint -> assertThat (typeHint .getType ()).isEqualTo (TypeReference .of (String .class )));
75
75
}
76
76
77
+ @ Test
78
+ void registerReflectiveHintsForMethodWithModelAttribute () throws NoSuchMethodException {
79
+ Method method = SampleController .class .getDeclaredMethod ("postForm" , Request .class );
80
+ processor .registerReflectionHints (hints , method );
81
+ assertThat (hints .typeHints ()).satisfiesExactlyInAnyOrder (
82
+ typeHint -> assertThat (typeHint .getType ()).isEqualTo (TypeReference .of (SampleController .class )),
83
+ typeHint -> {
84
+ assertThat (typeHint .getType ()).isEqualTo (TypeReference .of (Request .class ));
85
+ assertThat (typeHint .getMemberCategories ()).containsExactlyInAnyOrder (
86
+ MemberCategory .INVOKE_DECLARED_CONSTRUCTORS ,
87
+ MemberCategory .DECLARED_FIELDS );
88
+ assertThat (typeHint .methods ()).satisfiesExactlyInAnyOrder (
89
+ hint -> assertThat (hint .getName ()).isEqualTo ("getMessage" ),
90
+ hint -> assertThat (hint .getName ()).isEqualTo ("setMessage" ));
91
+ },
92
+ typeHint -> assertThat (typeHint .getType ()).isEqualTo (TypeReference .of (String .class )));
93
+ }
94
+
77
95
@ Test
78
96
void registerReflectiveHintsForMethodWithRestController () throws NoSuchMethodException {
79
97
Method method = SampleRestController .class .getDeclaredMethod ("get" );
@@ -177,6 +195,10 @@ Response get() {
177
195
void post (@ RequestBody Request request ) {
178
196
}
179
197
198
+ @ PostMapping
199
+ void postForm (@ ModelAttribute Request request ) {
200
+ }
201
+
180
202
@ GetMapping
181
203
@ ResponseBody
182
204
String message () {
0 commit comments