redis配置类报Could not autowire. No beans of ‘RedisConnectionFactory‘ type found.
redis配置类
·
@Configuration
public class RedisConfig {
@Bean
@SuppressWarnings(value = {“unchecked”,“rawtypes”})
public RedisTemplate<Object,Object> redisTemplate(RedisConnectionFactory factory){
RedisTemplate<Object,Object> template=new RedisTemplate<>();
template.setConnectionFactory(factory);
FastJsonRedisSerializer serializer=new FastJsonRedisSerializer(Object.class);
template.setKeySerializer(new StringRedisSerializer());
template.setValueSerializer(serializer);
template.setHashKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(serializer);
template.afterPropertiesSet();
return template;
}
}
由于这个包忘记引入
更多推荐
已为社区贡献2条内容
所有评论(0)