Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2203

Redis JsonJacksonCodec. Problem with LocalDateTime serialization

$
0
0

I am using Spring Boot 2, Redis server v=5.0.9, Java 14.I am trying to save object, which contains LocalDateTime field to RMap and getting next error:

"com.fasterxml.jackson.databind.exc.MismatchedInputException: Expected array or string."

Config for Redis:

ObjectMapper mapper = Jackson2ObjectMapperBuilder.json()             .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)             .modules(new JSR310Module())             .build();Config config = new Config();config.useSingleServer().setAddress("redis://127.0.0.1:6379");config.setCodec(new JsonJacksonCodec(mapper));

And field:

@JsonSerialize(using = LocalDateTimeSerializer.class)@JsonDeserialize(using = LocalDateTimeDeserializer.class)private LocalDateTime timeStamp;

Tried different options from google - nothing worked.

Really need your help!


Viewing all articles
Browse latest Browse all 2203

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>