1、lombok.jar可以帮助开发人员省去对get/set方法、构造方法的代码,使用步骤:
a、进入lombok.jar所在目录,使用java -jar lombok.jar,启动jar包
b、加载eclipse.exe执行文件,将lombok.jar作为插件植入到eclipse
c、属性类加 @Data 和 @NoArgsConstructor 注解
lombok.jar的语法:
@NotEmpty 与 @NotNull 的区别:
@NotEmpty适用于String、List、数组类型,表示不能为null,也不能为空
@NotNull 适用于Integer、Boolean等其他类型
2、mysql新版本的驱动: spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver,兼容旧的版本
3、JWT的调试:
login登录返回一个token,再次请求的时候,token写入 Request Header,K-V写法: Authorization-token
4、持久层执行SQL的时候,Java Bean的属性如果为 null,DB中设置了不能为null,会报错。例:
public class UserEntity extends BasePropertyEntity implements Serializable {
@Column(name = "status")
private Integer status;
}
执行DAO层调用的时候 UserEntity的status为 null,但是DB中设置了 `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态(0:停用,1:启用)',因此会报错 Column 'status' can not be null。
虽然status有默认值,但是只能在数据库端执行insert的时候默认生效,
字符串分割并生成List
String = "a,b,c,d,e";
Arrays.asList(authorities.split(",");