添加lombok
添加pom文件依赖
<dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.16</version> <scope>provided</scope> </dependency>
在class类上用@Data注解,自动提供getter和setter、hashCode、equals、toString等方法
@Data public class GithubUser { private String name; private long id; private String bio; }