Is there a way to avoid getter
and setter
in the spring-boot entity, sometimes I have a lot of columns in the database?
You can use Lombok
. It is a small java library that can be used to reduce the amount of boilerplate java code. Lombok
does this via annotations that can be added to the java classes.
For getters/setters
Lombok provides @Getter
and @Setter
annotations. You can add it to class data fields. it will generate getter
and setters
in the background.
Note: For detailed information refer https://projectlombok.org/features/GetterSetter