2121import org .springframework .aot .hint .RuntimeHints ;
2222import org .springframework .aot .hint .RuntimeHintsRegistrar ;
2323import org .springframework .aot .hint .TypeReference ;
24+ import org .springframework .data .redis .core .BoundGeoOperations ;
25+ import org .springframework .data .redis .core .BoundHashOperations ;
26+ import org .springframework .data .redis .core .BoundKeyOperations ;
27+ import org .springframework .data .redis .core .BoundListOperations ;
28+ import org .springframework .data .redis .core .BoundSetOperations ;
29+ import org .springframework .data .redis .core .BoundStreamOperations ;
30+ import org .springframework .data .redis .core .BoundValueOperations ;
31+ import org .springframework .data .redis .core .BoundZSetOperations ;
2432import org .springframework .lang .Nullable ;
2533
2634/**
2735 * @author Christoph Strobl
2836 * @since 3.0
2937 */
30- public class DataRedisRuntimeHints implements RuntimeHintsRegistrar {
38+ public class RedisRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
3139
3240 @ Override
3341 public void registerHints (RuntimeHints hints , @ Nullable ClassLoader classLoader ) {
@@ -107,7 +115,9 @@ public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader)
107115 TypeReference .of (org .springframework .data .redis .core .index .ConfigurableIndexDefinitionProvider .class ),
108116 TypeReference .of (org .springframework .data .redis .core .mapping .RedisMappingContext .class ),
109117 TypeReference .of (org .springframework .data .redis .repository .support .RedisRepositoryFactoryBean .class ),
110- TypeReference .of (org .springframework .data .redis .repository .query .RedisQueryCreator .class )),
118+ TypeReference .of (org .springframework .data .redis .repository .query .RedisQueryCreator .class ),
119+ TypeReference .of (org .springframework .data .redis .connection .MessageListener .class ),
120+ TypeReference .of (org .springframework .data .redis .listener .RedisMessageListenerContainer .class )),
111121 hint -> hint .withMembers (MemberCategory .INVOKE_DECLARED_CONSTRUCTORS ,
112122 MemberCategory .INVOKE_PUBLIC_METHODS ));
113123
@@ -121,5 +131,28 @@ public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader)
121131 TypeReference .of (org .springframework .data .redis .connection .StringRedisConnection .class ),
122132 TypeReference .of (org .springframework .data .redis .connection .DecoratedRedisConnection .class ));
123133
134+ // keys are bound by a proxy
135+ boundOperationsProxy (BoundGeoOperations .class , hints );
136+ boundOperationsProxy (BoundHashOperations .class , hints );
137+ boundOperationsProxy (BoundKeyOperations .class , hints );
138+ boundOperationsProxy (BoundListOperations .class , hints );
139+ boundOperationsProxy (BoundSetOperations .class , hints );
140+ boundOperationsProxy (BoundStreamOperations .class , hints );
141+ boundOperationsProxy (BoundValueOperations .class , hints );
142+ boundOperationsProxy (BoundZSetOperations .class , hints );
143+ boundOperationsProxy (
144+ TypeReference .of ("org.springframework.data.redis.core.BoundOperationsProxyFactory$DefaultBoundKeyOperations" ),
145+ hints );
146+ }
147+
148+ private void boundOperationsProxy (Class <?> type , RuntimeHints hints ) {
149+ boundOperationsProxy (TypeReference .of (type ), hints );
150+ }
151+
152+ private void boundOperationsProxy (TypeReference typeReference , RuntimeHints hints ) {
153+ hints .proxies ().registerJdkProxy (typeReference , //
154+ TypeReference .of ("org.springframework.aop.SpringProxy" ), //
155+ TypeReference .of ("org.springframework.aop.framework.Advised" ), //
156+ TypeReference .of ("org.springframework.core.DecoratingProxy" ));
124157 }
125158}
0 commit comments