@Configuration public class RedisConfig { @Bean @SuppressWarnings(value = {“unchecked”,“rawtypes”}) public RedisTemplate redisTemplate(RedisConnectionFactory factory){ RedisTemplate 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; } } 由于这个包忘记引入
上一篇 JAVA知识体系之问题处理篇(三)——用错CompletionService导致的内存泄漏问题
下一篇 关于java空指针的常见错误和处理方案
版权所有 (c)2021-2022 MSHXW.COM
ICP备案号:晋ICP备2021003244-6号