diff --git a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/bean/ServiceContext.java b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/bean/ServiceContext.java index 86936fc5..73877b2d 100644 --- a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/bean/ServiceContext.java +++ b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/bean/ServiceContext.java @@ -31,7 +31,11 @@ public class ServiceContext extends ConcurrentHashMap { } public Locale getLocale() { - return getRequest().getLocale(); + HttpServletRequest request = getRequest(); + if (request == null) { + return Locale.SIMPLIFIED_CHINESE; + } + return request.getLocale(); } /**