I want to store an Object in Redis using Spring-Data-Redis, but it just doesn't save. If I change payload to a String, it DOES save. I originally had this as a JsonNode, but this caused a problem with Jackson, so I am using Object to fix that. The payload is received as Json from a third party. This is my Entity to be saved:
@Data@AllArgsConstructor@NoArgsConstructor@RedisHash("FruitPayload")public class FruitPayload implements Serializable { @Id private String id; private Object payload;}
This is the code that calls it:
final Object responseBody = responseEntity.getBody();FruitPayload fruitPayload = new FruitPayload(key, responseBody);if(Objects.nonNull(responseBody)) { FruitPayload savedPayload = fruitPayloadRepository.save(fruitPayload); }
If I run in debug in Intellij, the savedPayload has the data. However, if I check Redis, the key is there, but the payload is null. How can I store this payload in Redis?