Commit 95355cb522df0eeb5950a1f8a982680854ebcda5
1 parent
2c0d4073
fix: 【framework】TimestampLocalDateTimeSerializer 中,使用 ReflectUtil 替代
Showing
1 changed file
with
2 additions
and
2 deletions
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/databind/TimestampLocalDateTimeSerializer.java
| 1 | 1 | package cn.iocoder.yudao.framework.common.util.json.databind; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.util.ReflectUtil; | |
| 3 | 4 | import com.fasterxml.jackson.annotation.JsonFormat; |
| 4 | 5 | import com.fasterxml.jackson.core.JsonGenerator; |
| 5 | 6 | import com.fasterxml.jackson.databind.JsonSerializer; |
| 6 | 7 | import com.fasterxml.jackson.databind.SerializerProvider; |
| 7 | -import org.apache.commons.lang3.reflect.FieldUtils; | |
| 8 | 8 | |
| 9 | 9 | import java.io.IOException; |
| 10 | 10 | import java.lang.reflect.Field; |
| ... | ... | @@ -25,7 +25,7 @@ public class TimestampLocalDateTimeSerializer extends JsonSerializer<LocalDateTi |
| 25 | 25 | public void serialize(LocalDateTime value, JsonGenerator gen, SerializerProvider serializers) throws IOException { |
| 26 | 26 | String fieldName = gen.getOutputContext().getCurrentName(); |
| 27 | 27 | Class<?> clazz = gen.getOutputContext().getCurrentValue().getClass(); |
| 28 | - Field field = FieldUtils.getField(clazz, fieldName, true); | |
| 28 | + Field field = ReflectUtil.getField(clazz, fieldName); | |
| 29 | 29 | // 情况一:有 JsonFormat 自定义注解,则使用它。https://github.com/YunaiV/ruoyi-vue-pro/pull/1019 |
| 30 | 30 | JsonFormat[] jsonFormats = field.getAnnotationsByType(JsonFormat.class); |
| 31 | 31 | if (jsonFormats.length > 0) { | ... | ... |