Closed as not planned
Closed as not planned
Description
org.springframework.data.redis.core.RedisHash has a field timeToLive typed as long therefor you cannot use SPeL/Spring-style expression.
timeToLive is often a property coming from env properties and therefor pass from parameter.
The current definition of @RedisHash is @RedisHash(value="myIndex", timeToLive=60)
The issue seems to come from a long running issue (compiler issue) here @scheduled
However this is annoying because that force user of @RedisHash to define all index/entity globally using RedisMappingContext bean
@Bean
public RedisMappingContext keyValueMappingContext() {
return new RedisMappingContext(new MappingConfiguration(new IndexConfiguration(), new MyKeyspaceConfiguration()));
}
public class MyKeyspaceConfiguration extends KeyspaceConfiguration {
@Override
protected Iterable<KeyspaceSettings> initialConfiguration() {
KeyspaceSettings keyspace = new KeyspaceSettings(Index.class, "myindex:Index");
keyspace.setTimeToLive(MyIndex.getTtlInSeconds().longValue());
return Collections.singleton(keyspace);
}
}
linked to : spring-projects/spring-boot#41256