Skip to content

Commit

Permalink
fix: ObjectMapper的默认日期转化问题 Close #729 (#731)
Browse files Browse the repository at this point in the history
* build: upgrade to v0.20.2

* fix: ObjectMapper的默认日期转化问题 Close #729
  • Loading branch information
chivehao authored Nov 10, 2024
1 parent 0eb351c commit d74169b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

更新日志文档,版本顺序从新到旧,最新版本在最前(上)面。

# 0.20.2

## 问题修复

- ObjectMapper的默认日期转化问题 #729

# 0.20.1

## 优化
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=0.20.1
version=0.20.2
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.springframework.data.redis.serializer.StringRedisSerializer;
import run.ikaros.server.cache.condition.CacheMemoryEnableCondition;
import run.ikaros.server.cache.condition.CacheRedisEnableCondition;
import run.ikaros.server.infra.utils.JsonUtils;

@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties(CacheProperties.class)
Expand Down Expand Up @@ -41,7 +42,7 @@ public ReactiveRedisTemplate<String, Object> reactiveRedisTemplate(
RedisSerializationContext.RedisSerializationContextBuilder<String, Object> builder =
RedisSerializationContext.newSerializationContext();
GenericJackson2JsonRedisSerializer objectSerializer =
new GenericJackson2JsonRedisSerializer();
new GenericJackson2JsonRedisSerializer(JsonUtils.getObjectMapper());
StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
builder.key(stringRedisSerializer);
builder.value(objectSerializer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import lombok.Getter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.Assert;
Expand All @@ -20,6 +21,7 @@
public class JsonUtils {
private static final Logger logger = LoggerFactory.getLogger(JsonUtils.class);

@Getter
private static final ObjectMapper objectMapper = new ObjectMapper();

static {
Expand Down

0 comments on commit d74169b

Please sign in to comment.