lombok使用
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.8</version>
</dependency>
配置文件中添加依赖
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-OTrTRHrF-1597306021932)(C:\Users\1\AppData\Roaming\Typora\typora-user-images\image-20200813160405105.png)]
idea插件中下载lombok
import lombok.Data;
import java.util.Date;
@Data
public class UserVO {
private Integer id;
private String username;
private String password;
private Byte sex;
private Byte deleted;
private Date updateTime;
}
代码中使用@Data修饰符
@Slf4j
@RestController
public class UserContorller {
@GetMapping ("/hello")
public String hello(){
return "hello";
}
@GetMapping ("/user")
public UserVO user(){
UserVO userVo = new UserVO();
userVo.setId(100);
userVo.setUsername("wang");
log.error("error");
return userVo;
}
}
@Slf4j使用日志