Я использую Redis как кеш в весеннем загрузочном проекте. В контроллере rest api вернуть объект ResponseEntity. Когда я использую @Cacheable перед любым методом, он дает Cannot deserialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to deserialize payload.
Этот код работает с Postgres и Java8.
@Cacheable(value = "users", key = "#userId")
@GetMapping("{id}")
public ResponseEntity<User> getUserById( @PathVariable(value = "id") Long userId) {
return new ResponseEntity<User>(userService.getUser(userId), HttpStatus.OK);
}
Использование аннотации @Cacheable на уровне службы также приводит к той же ошибке.