Home  >  Article  >  Java  >  Spring MVC+Fastjson time type serialization

Spring MVC+Fastjson time type serialization

怪我咯
怪我咯Original
2017-06-23 11:53:041623browse

Time type serialization:

Note the red code, the JSONField class of fastjson must be introduced, not others.

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; 
}

The above is the detailed content of Spring MVC+Fastjson time type serialization. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn