DefaultSerializer requires a Serializable payload but received an object of type...

将实体类继承Serializable

     Student stu= null;
       ...
        redisTemplate.opsForValue().set(key+ token, stu);
        redisTemplate.expire(key+ token,expiration, TimeUnit.MILLISECONDS);

在这里,如果Student类没有继承Serializable,就会报上面的错误;

posted @ 2019-11-21 18:50  忧伤还是快乐EL  阅读(1947)  评论(0编辑  收藏  举报