Reputation: 1
I've tried following code but got error - spring web ResponseEntity can't serialization.
org.springframework.data.redis.serializer.SerializationException: Cannot serialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.lang.IllegalArgumentException: DefaultSerializer requires a Serializable payload but received an object of type [org.springframework.http.ResponseEntity]
Tried following code:
@Override
@Transactional
@Cacheable(value = "mostFollowedSub", key = "{#root.methodName, #offset, #limit}" )
public ResponseEntity<Response> mostFollowedSubCategory(int offset, int limit) {
return subCategoryDao.getMostFollowedSubCategory(offset, limit);
}
Upvotes: 0
Views: 3316
Reputation: 9102
ResponseEntity
is not Serializable
. Better way is to cache at the service/DAO layer ( in your case getMostFollowedSubCategory
method of subCategoryDao
).
Upvotes: 2