1515 */
1616package org .springframework .data .web .aot ;
1717
18+ import org .springframework .aot .hint .MemberCategory ;
1819import org .springframework .aot .hint .RuntimeHints ;
1920import org .springframework .aot .hint .RuntimeHintsRegistrar ;
2021import org .springframework .aot .hint .TypeReference ;
22+ import org .springframework .data .web .PagedModel ;
2123import org .springframework .data .web .config .SpringDataJacksonConfiguration .PageModule ;
2224import org .springframework .lang .Nullable ;
2325import org .springframework .util .ClassUtils ;
@@ -34,8 +36,30 @@ class WebRuntimeHints implements RuntimeHintsRegistrar {
3436 public void registerHints (RuntimeHints hints , @ Nullable ClassLoader classLoader ) {
3537
3638 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
3746 hints .reflection ().registerType (TypeReference .of ("org.springframework.data.domain.Unpaged" ),
3847 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+ });
3963 }
4064 }
4165}
0 commit comments