Answer the question
In order to leave comments, you need to log in
Spring boot cache return list of objects with null?
Hello! The first time I get data from the database, everything works fine, but when I get null attribute values from the cache
``` code
@Cacheable(value = "userStore)
public List<UserDto> getAllUsers(String typeCode) {
return userRepo.findAllByType(typeCode).stream().map(this::mapEntityToDto).collect(Collectors.toList());
}
[
{
"login": null,
"name": null
},
{
"login": null,
"name": null
},
{
"login": null,
"name": null
}
]
��srjava.util.ArrayListx����a�......
Answer the question
In order to leave comments, you need to log in
Returned null fields, because it inherits these fields from the parent, and it was not serializable.
If your object is serializable and extends an object that is not serializable, then instead of the NotSerializeException which would be useful, the fields of the parent object are only initialized which is why you have them as nulls.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question