@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;
}
}
由于这个包忘记引入