新增 lang.defaultLocale 和 lang.defaultTimeZone
指定默认语言和默认时区参数(解决某些linux下的国际化的问题)
This commit is contained in:
@@ -26,6 +26,7 @@ import com.fasterxml.jackson.databind.SerializerProvider;
|
|||||||
import com.fasterxml.jackson.databind.util.JSONPObject;
|
import com.fasterxml.jackson.databind.util.JSONPObject;
|
||||||
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
|
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
|
||||||
import com.jeesite.common.collect.ListUtils;
|
import com.jeesite.common.collect.ListUtils;
|
||||||
|
import com.jeesite.common.io.PropertiesUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 简单封装Jackson,实现JSON String<->Java Object的Mapper.
|
* 简单封装Jackson,实现JSON String<->Java Object的Mapper.
|
||||||
@@ -55,8 +56,9 @@ public class JsonMapper extends ObjectMapper {
|
|||||||
this.configure(Feature.ALLOW_SINGLE_QUOTES, true);
|
this.configure(Feature.ALLOW_SINGLE_QUOTES, true);
|
||||||
// 允许不带引号的字段名称
|
// 允许不带引号的字段名称
|
||||||
this.configure(Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
|
this.configure(Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
|
||||||
// 设置时区
|
// 设置默认时区
|
||||||
this.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
|
this.setTimeZone(TimeZone.getTimeZone(PropertiesUtils.getInstance()
|
||||||
|
.getProperty("lang.defaultTimeZone", "GMT+08:00")));
|
||||||
// 设置输入时忽略在JSON字符串中存在但Java对象实际没有的属性
|
// 设置输入时忽略在JSON字符串中存在但Java对象实际没有的属性
|
||||||
this.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
this.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
||||||
// 遇到空值处理为空串
|
// 遇到空值处理为空串
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.JavaType;
|
import com.fasterxml.jackson.databind.JavaType;
|
||||||
|
import com.jeesite.common.io.PropertiesUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XML <-> Map、Object
|
* XML <-> Map、Object
|
||||||
@@ -49,8 +50,9 @@ public class XmlMapper extends com.fasterxml.jackson.dataformat.xml.XmlMapper{
|
|||||||
public XmlMapper() {
|
public XmlMapper() {
|
||||||
// Spring ObjectMapper 初始化配置,支持 @JsonView
|
// Spring ObjectMapper 初始化配置,支持 @JsonView
|
||||||
new Jackson2ObjectMapperBuilder().configure(this);
|
new Jackson2ObjectMapperBuilder().configure(this);
|
||||||
// 设置时区
|
// 设置默认时区
|
||||||
this.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
|
this.setTimeZone(TimeZone.getTimeZone(PropertiesUtils.getInstance()
|
||||||
|
.getProperty("lang.defaultTimeZone", "GMT+08:00")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Binary file not shown.
@@ -203,7 +203,12 @@ menu:
|
|||||||
# 国际化管理(专业版)
|
# 国际化管理(专业版)
|
||||||
lang:
|
lang:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
||||||
|
# 默认语言
|
||||||
|
defaultLocale: zh_CN
|
||||||
|
# 默认时区
|
||||||
|
defaultTimeZone: GMT+08:00
|
||||||
|
|
||||||
# 任务调度(个人版)
|
# 任务调度(个人版)
|
||||||
job:
|
job:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|||||||
@@ -256,6 +256,11 @@ logging:
|
|||||||
# 国际化管理(专业版)
|
# 国际化管理(专业版)
|
||||||
#lang:
|
#lang:
|
||||||
# enabled: false
|
# enabled: false
|
||||||
|
#
|
||||||
|
# # 默认语言
|
||||||
|
# defaultLocale: zh_CN
|
||||||
|
# # 默认时区
|
||||||
|
# defaultTimeZone: GMT+08:00
|
||||||
|
|
||||||
# 任务调度(个人版)
|
# 任务调度(个人版)
|
||||||
#job:
|
#job:
|
||||||
|
|||||||
Reference in New Issue
Block a user