For security reasons I want to rename the command set and flushDb using the redis configuration. But I'm using the redisTemplate which only allows me to use the methods set and flushDb and not a renamed command
Below my used configuration:
@Bean
public RedisTemplate<String, Person> redisTemplate() {
RedisTemplate<String, Person> template = new RedisTemplate<>()
template.setConnectionFactory(redisConnectionFactory)
template.setKeySerializer(new StringRedisSerializer())
template.setValueSerializer(new JacksonJsonRedisSerializer<>(Person.class))
template.setHashKeySerializer(new StringRedisSerializer())
template.setHashValueSerializer(new JacksonJsonRedisSerializer<>(Person.class))
return template
}
The normal way to set my object in Redis is like:
public void savePerson(Person person) {
String key = "personId:${person.id}"
redisTemplate.opsForValue().set(key, person)
}
Any ideas?