15
15
*/
16
16
package org .springframework .data .web .aot ;
17
17
18
+ import org .springframework .aot .hint .MemberCategory ;
18
19
import org .springframework .aot .hint .RuntimeHints ;
19
20
import org .springframework .aot .hint .RuntimeHintsRegistrar ;
20
21
import org .springframework .aot .hint .TypeReference ;
22
+ import org .springframework .data .web .PagedModel ;
21
23
import org .springframework .data .web .config .SpringDataJacksonConfiguration .PageModule ;
22
24
import org .springframework .lang .Nullable ;
23
25
import org .springframework .util .ClassUtils ;
@@ -34,8 +36,30 @@ class WebRuntimeHints implements RuntimeHintsRegistrar {
34
36
public void registerHints (RuntimeHints hints , @ Nullable ClassLoader classLoader ) {
35
37
36
38
if (ClassUtils .isPresent ("com.fasterxml.jackson.databind.ObjectMapper" , classLoader )) {
39
+
40
+ // Page Model for Jackson Rendering
41
+ hints .reflection ().registerType (org .springframework .data .web .PagedModel .class ,
42
+ MemberCategory .INVOKE_PUBLIC_METHODS );
43
+ hints .reflection ().registerType (PagedModel .PageMetadata .class , MemberCategory .INVOKE_PUBLIC_METHODS );
44
+
45
+ // Type that might not be seen otherwise
37
46
hints .reflection ().registerType (TypeReference .of ("org.springframework.data.domain.Unpaged" ),
38
47
hint -> hint .onReachableType (PageModule .class ));
48
+
49
+ // Jackson Converters used via @JsonSerialize in SpringDataJacksonConfiguration
50
+ hints .reflection ().registerType (
51
+ TypeReference
52
+ .of ("org.springframework.data.web.config.SpringDataJacksonConfiguration$PageModule$PageModelConverter" ),
53
+ hint -> {
54
+ hint .withMembers (MemberCategory .INVOKE_DECLARED_CONSTRUCTORS , MemberCategory .INVOKE_PUBLIC_METHODS );
55
+ hint .onReachableType (PageModule .class );
56
+ });
57
+ hints .reflection ().registerType (TypeReference .of (
58
+ "org.springframework.data.web.config.SpringDataJacksonConfiguration$PageModule$PlainPageSerializationWarning" ),
59
+ hint -> {
60
+ hint .withMembers (MemberCategory .INVOKE_DECLARED_CONSTRUCTORS , MemberCategory .INVOKE_PUBLIC_METHODS );
61
+ hint .onReachableType (PageModule .class );
62
+ });
39
63
}
40
64
}
41
65
}
0 commit comments