Use java lombok in POJO.

You need to add lombok dependency into your pom file:

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.16.18</version>
    <scope>provided</scope>
</dependency>

and you need to install lombok ito your IDE with this command:
java -jar lombok-1.16.18.jar

The @Data annotation will give you everything including getter/Setter/ hashcode /equals and toString methods.


import lombok.Data;

@Data
public class Person {
	private Integer age;
	private String name;
}