feat:jwt中的hutool-json改为fastjson

This commit is contained in:
曾文豪
2024-08-23 14:10:47 +08:00
parent 856a9f01dd
commit 9bab4cdb25
15 changed files with 105 additions and 233 deletions

View File

@@ -6,6 +6,8 @@ import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import cn.hutool.log.LogFactory;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.tiesheng.util.exception.ApiException;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@@ -26,6 +28,18 @@ import java.util.List;
@ConfigurationProperties(prefix = "tiesheng.global")
public class GlobalConfig {
static {
JSON.DEFFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
// FASTJSON 设置全局序列化配置
JSON.DEFAULT_GENERATE_FEATURE |= SerializerFeature.WriteMapNullValue.getMask();
JSON.DEFAULT_GENERATE_FEATURE |= SerializerFeature.WriteNullStringAsEmpty.getMask();
JSON.DEFAULT_GENERATE_FEATURE |= SerializerFeature.WriteEnumUsingName.getMask();
JSON.DEFAULT_GENERATE_FEATURE |= SerializerFeature.WriteDateUseDateFormat.getMask();
JSON.DEFAULT_GENERATE_FEATURE |= SerializerFeature.DisableCircularReferenceDetect.getMask();
}
private String host;
private String service;
private String version;