| | |
| | | import org.springframework.data.redis.core.ValueOperations; |
| | | import org.springframework.data.redis.core.ZSetOperations; |
| | | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; |
| | | import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer; |
| | | import org.springframework.data.redis.serializer.RedisSerializer; |
| | | import org.springframework.data.redis.serializer.StringRedisSerializer; |
| | | |
| | |
| | | //Jackson2JsonRedisSerializer<Object> jacksonSeial = new Jackson2JsonRedisSerializer<>(Object.class); |
| | | ObjectMapper om = new ObjectMapper(); |
| | | om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); |
| | | om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); |
| | | |
| | | //om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); |
| | | om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); |
| | | //om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL,JsonTypeInfo.As.WRAPPER_ARRAY); |
| | | |
| | | jacksonSeial.setObjectMapper(om); |
| | | template.setValueSerializer(jacksonSeial); |
| | | template.setKeySerializer(new StringRedisSerializer()); |
| | | template.setHashKeySerializer(new StringRedisSerializer()); |
| | | |
| | | //new JdkSerializationRedisSerializer(classLoader); |
| | | |
| | | //template.setHashKeySerializer(new StringRedisSerializer()); |
| | | |
| | | ClassLoader classLoader = getClass().getClassLoader(); |
| | | template.setHashKeySerializer(new JdkSerializationRedisSerializer(classLoader)); |
| | | template.setHashValueSerializer(jacksonSeial); |
| | | template.afterPropertiesSet(); |
| | | return template; |