赞
踩
运行结果:
redis配置文件需要序列化:
- @Bean
- public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
- RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>();
- redisTemplate.setConnectionFactory(redisConnectionFactory);
-
- StringRedisSerializer serializer = new StringRedisSerializer();
- redisTemplate.setKeySerializer(serializer);
- redisTemplate.setValueSerializer(serializer);
- return redisTemplate;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。