Advertisement

Spring Boot 集成 Redis 并支持 Fast Jason 作为序列化器 存取类对象

阅读量:

目的

复制代码
    @SpringBootTest
    class Springboot01ApplicationTests {
    
    @Autowired
    private  RedisTemplate<Object,Object> redisTemplate;
    @Test
    public void redis() {
        RedisConnection connection = redisTemplate.getConnectionFactory().getConnection();
        Motor motor = new Motor(1234, 22, 1, 1, 1, 1, 1, 1);
        redisTemplate.opsForValue().set("cwd",motor);
        //Motor cwd = (Motor) redisTemplate.opsForValue().get("cwd");
        //System.out.println(cwd.getTargetPosition());
    }
      }
    
    
      
      
      
      
      
      
      
      

全部评论 (0)

还没有任何评论哟~