被java的注解恶心到了
一个实体类,总共才几个属性,竟然一多半的代码都是注解。
@ApiModel(value="博客作者对象",description="博客作者对象信息")
@Entity
@JsonIgnoreProperties(value = { "hibernateLazyInitializer" })
public class Author {
public Author() {
super();
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@ApiModelProperty(value="用户名",name="username",example="落安")
private String username;
@ApiModelProperty(value="年龄",name="age",example="21")
private int age;
@ApiModelProperty(value="id数组",hidden=true)
@JsonIgnoreProperties(value = {"author"})
@JoinColumn(name = "author_id")
@OneToMany
private List<BlogModel> blogs;
public void setBlogs(List<BlogModel> blogs) {
this.blogs = blogs;
}
public List<BlogModel> getBlogs() {
return blogs;
}
}