我@GetMapping
在Spring boot中遇到问题。
这是关于我的@GetMapping
函数id
在从数据库中获取所有数据时不会在这个模型上序列化我的函数:
//User.java
@Entity
@Table(name = "users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "username")
private String username;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "joined_date")
@CreatedDate
private Date joinedDate;
@Column(name = "password")
private String password;
@Column(name = "bio")
private String bio;
@Column(name = "email")
private String email;
}
我尝试了很多方法,但根本无法解决。甚至这个问题:Spring boot @ResponseBody does not serialize entity id
这是下图: