Our redis cache starts returning empty objects (object created with no arg constructor) instead Optional.empty()
Steps to reproduce
myImplRedisCacheRepository.findById("anyRandomString");
Alternatively it also is broken when returning a list, it contains single element with "empty object"
myImplRedisCacheRepository.findAllById(List.of("anyRandomString"))
Thats affects 2.3.2.RELEASE, we discovered it after updating gradle plugin from
id("org.springframework.boot") version "2.3.1.RELEASE"
to
id("org.springframework.boot") version "2.3.2.RELEASE"
Repository:
@Repository
public interface MyImplRedisCacheRepository extends CrudRepository<MyImpl, String> {
}
Redis config:
spring:
redis:
host: "localhost"
port: 6379
password:
@Configuration
@EnableRedisRepositories(keyspaceConfiguration = CacheConfig.CustomKeyspaceConfiguration.class)
public class CacheConfig {
static class CustomKeyspaceConfiguration extends KeyspaceConfiguration {
@Value("${service.cache.time-to-live}")
private Duration timeToLive;
@Override
public boolean hasSettingsFor(Class<?> type) {
return true;
}
@Override
public KeyspaceSettings getKeyspaceSettings(Class<?> type) {
KeyspaceSettings keyspaceSettings =
new KeyspaceSettings(type, "my-project-keyspace");
keyspaceSettings.setTimeToLive(timeToLive.toSeconds());
return keyspaceSettings;
}
}
}
Redis cluster started as docker image docker run -d -p 6379:6379 --name redis redis
Comment From: wilkinsona
Thanks for the report, but Spring Data Redis is managed as a separate project and they use JIRA for issue tracking. Could you please open an issue over there and comment here with a link to it so that we can follow along?
Comment From: thankusWR
Ok, thank you for link. https://jira.spring.io/browse/DATAREDIS-1192 I was able to localize code change potentially responsible for that (link and details in above ticket).
Comment From: codebuks
i meet the same problem,i have to fall back to 2.3.1;