Skip to content

Commit e99463c

Browse files
Add missing RedisClient runtime hint.
Closes: #2440
1 parent 53c08d5 commit e99463c

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright 2022 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.data.redis.connection.lettuce.aot;
17+
18+
import org.springframework.aot.hint.MemberCategory;
19+
import org.springframework.aot.hint.RuntimeHints;
20+
import org.springframework.aot.hint.RuntimeHintsRegistrar;
21+
import org.springframework.aot.hint.TypeReference;
22+
import org.springframework.lang.Nullable;
23+
import org.springframework.util.ClassUtils;
24+
25+
/**
26+
* @author Christoph Strobl
27+
* @since 3.0
28+
*/
29+
class LettuceRuntimeHints implements RuntimeHintsRegistrar {
30+
31+
@Override
32+
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
33+
34+
if (ClassUtils.isPresent("io.lettuce.core.RedisClient", classLoader)) {
35+
36+
hints.reflection().registerType(TypeReference.of("io.lettuce.core.RedisClient"),
37+
it -> it
38+
.onReachableType(
39+
TypeReference.of("org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider"))
40+
.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.DECLARED_FIELDS));
41+
}
42+
}
43+
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
org.springframework.aot.hint.RuntimeHintsRegistrar=\
2-
org.springframework.data.redis.aot.RedisRuntimeHints
2+
org.springframework.data.redis.aot.RedisRuntimeHints,\
3+
org.springframework.data.redis.connection.lettuce.aot.LettuceRuntimeHints

0 commit comments

Comments
 (0)