Redis configuration error org.springframework.data.redis.serializer.SerializationException: Could not write JSON

Follow the video of station B to do the springboot and vue front-end separation project.

Video address  2023 The simplest but practical SpringBoot+Vue front-end and back-end separation project actual combat_哔哩哔哩_bilibili

At the end of episode 17, an error is reported when redis is configured, and an error 500 is reported for the postman interface.

The backend error message is as follows:

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.data.redis.serializer.SerializationException: Could not write JSON: Java 8 date/time type 
`java.time.LocalDateTime` not supported by default: add Module "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling (through reference chain: com.lantu.sys.entity.User["createTime"]); nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Java 8 date/time type `java.time.LocalDateTime` not supported by default: add Module "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling (through reference chain: com.lantu.sys.entity.User["createTime"])] with root cause

java.time.LocalDateTimeThis error is caused by encountering an unsupported Java 8 date/time type when using Jackson for JSON serialization .

After making some modifications, the problem is solved:

First add the dependency of the Jackson module in the pom file

The configuration file was modified as follows:

 

problem solved

 

 

Guess you like

Origin blog.csdn.net/lina_lee1/article/details/130349919