This commit is contained in:
2023-11-12 21:32:05 +08:00
parent 2b24a77a86
commit df807060e4

View File

@@ -1,5 +1,6 @@
package cn.lihongjie.coal.spring.config;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
@@ -20,6 +21,10 @@ public class CacheConfig {
@Bean
public RedisCacheConfiguration cacheConfiguration() {
objectMapper = objectMapper.copy();
objectMapper =
objectMapper.enableDefaultTyping(
ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY);
return RedisCacheConfiguration.defaultCacheConfig()
.entryTtl(Duration.ofMinutes(10))
.disableCachingNullValues()