Skip to content

Instantly share code, notes, and snippets.

@dolt131943
Created December 9, 2018 12:52
Show Gist options
  • Save dolt131943/c8c378621b3c30280e6f297a92c5ea77 to your computer and use it in GitHub Desktop.
Save dolt131943/c8c378621b3c30280e6f297a92c5ea77 to your computer and use it in GitHub Desktop.
FastJson设置了默认日期格式后就无法使用JSONField进行设置日期格式了!!!
com.alibaba.fastjson.support.config.FastJsonConfig config = new com.alibaba.fastjson.support.config.FastJsonConfig();
		config.setSerializerFeatures(SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue);
		config.setDateFormat("yyyy-MM-dd HH:mm:ss");
 @JSONField(format="yyyy-MM-dd@HH:mm:ss.SSSZ")
    public Date getCreateTime() {
        return createTime;
    }

如果使用上述语句设置了日期格式,则在类里使用JSONField就不会生效,其实应该是如果有个性化的用个性化的,否则才用全局默认的。这个设计不合理。 如果取消了默认的日期格式设计,则JSONField才会生效。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment