您正在Redis集群模式下运行Elasticache(只有Redis集群以
MOVED
Spring Boot可以自动配置您手动设置的所有内容。基本上,删除您的
CacheConfiguration
@Configuration
public class CacheConfiguration {
@Bean
public RedisTemplate<String, Company> redisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, Company> template = new RedisTemplate();
template.setConnectionFactory(connectionFactory);
return template;
}
}
然后在中配置以下属性
application.properties
spring.redis.cluster.nodes=<node_host>:<port>
弹簧防尘套负载
默认情况下,Redis自动配置配置
RedisTemplate<Object, Object>
默认情况下为bean。专门化bean是一个有效的用例,不要重复自动配置已经提供的内容,特别是如果您想要实现自动配置的功能。
另请参见: