正文
Spring MVC+Fastjson之时间类型序列化
小程序:扫一扫查出行
【扫一扫了解最新限行尾号】
复制小程序
【扫一扫了解最新限行尾号】
复制小程序
时间类型序列化:
注意红色代码,必须引入fastjson的JSONField类,而非其它。
import com.alibaba.fastjson.annotation.JSONField;@Entity
@Table(name="User")
public class User{
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@JSONField (format="yyyy-MM-dd HH:mm:ss")
public Date createTime;
}