今天看到有代码中的Dao包中的类文件,写的极其简洁,甚至引起了开发工具InteliJ的报错,然后程序还能稳健地跑起来。
import lombok.Data;
@Data
public class VaildCode {
private String code;
private long expTime;
}
原来是这个类加了@Data注解,所有Java代码中不需要生成getters and setters,而在编译的时候会自动生成getters and setters
点击导入的包,查看到如下