com.admin4j.redis.factory.RedisSerializerFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of redis-spring-boot-starter Show documentation
Show all versions of redis-spring-boot-starter Show documentation
redis序列化器自动装配starter。默认使用jackson,支持fastjson,fastjson2
package com.admin4j.redis.factory;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializer;
/**
* @author andanyang
* @since 2023/5/16 11:11
*/
public class RedisSerializerFactory {
public static RedisTemplate defaultRedisSerializer(RedisConnectionFactory connectionFactory) {
//jackson序列化工具
Jackson2JsonRedisSerializer