When springsecurity occurs SerializationException problem
01 Abnormal occurrence scenario
When I use springsecurity, there is a problem with the token access interface after successful login.
org.springframework.data.redis.serializer.SerializationException:Could not read JSON:Unrecognized field "username"(classcom.example.demo.entity.LoginUser), not marked as ignorable (2 known properties:"msUser","authorities"])
02 Reasons for the problem
The log says very clearly, Unable to read JSON: Unrecognized field
Originally I thought there was a problem with the format during storage.
But I checked the tool class and storage code and determined that there is no problem.
Later I found out that my entity class was not serialized
03 Solution
Add the annotation @JsonIgnoreProperties(ignoreUnknown = true) to the entity class