spring-petclinic-microservices
spring-petclinic-microservices copied to clipboard
Consider removing Lombok
Now that the application is based on Java 17, we could consider removing Lombok
and using the Record
instead.
Can I take this task?
Yes, sure @shobhakamath I'm not sure removing Lombok without adding boilerplate code is possible anywhere. But you could try by submitting small pull request
I'm afraid it won't be possible to use records for Jpa @ Entity'ies. My concern is https://vladmihalcea.com/java-records-jpa-hibernate/
Can Java Records be used as JPA or Hibernate entities? One very common question is if Java records are going to simplify the way we are building JPA or Hibernate entities. And, the answer is no. They will not.
According to the JPA specification, an entity must follow these requirements:
the entity class needs to be non-final, the entity class needs to have a no-arg constructor that is either public or protected, the entity attributes must be non-final. However, as explained by this article, the Java Record type is defined like this:
the associated Java class is final, there is only one constructor that takes all attributes, the Java record attributes are final. So, according to the JPA specifications, a Java Record cannot be used as an entity.
You're right @bastiat
For JPA entities we could not use record but we could generate getters/setters with IDE
In this repository, Lombok is also used by DTO
, Service
and Controller