springboot redistemplate 写入redis后值前面有乱码
程序员文章站
2022-07-12 20:59:15
...
解决办法,千万不要设置 HashKeySerializer HashValueSerializer,不然的话用别的序列化器写string数据的时候会多一些乱码
package com.lty.dispatch.conf;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
@Configuration
public class RedisConfig {
@Bean
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
上一篇: java怎么安装_详解在Linux系统中安装JDK
下一篇: springboot-json转换