Add serialization configuration for cache.support.NullValue

This commit makes sure to register serialization of null values for usage within a native image.

Closes: #2403
This commit is contained in:
Christoph Strobl
2022-09-09 10:21:10 +02:00
parent 7d34afbcaa
commit 55a27db3c4

View File

@@ -31,6 +31,7 @@ import org.springframework.data.keyvalue.repository.KeyValueRepository;
import org.springframework.data.keyvalue.repository.config.QueryCreatorType;
import org.springframework.data.keyvalue.repository.query.KeyValuePartTreeQuery;
import org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactoryBean;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.*;
import org.springframework.data.redis.core.*;
import org.springframework.data.redis.core.convert.KeyspaceConfiguration;
@@ -59,6 +60,10 @@ class RedisRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
// CACHE
hints.serialization().registerType(org.springframework.cache.support.NullValue.class,
hint -> hint.onReachableType(TypeReference.of(RedisCacheManager.class)));
// REFLECTION
hints.reflection().registerTypes(Arrays.asList(TypeReference.of(RedisConnection.class),
TypeReference.of(StringRedisConnection.class), TypeReference.of(DefaultedRedisConnection.class),