Skip to content

Tag: lombok

Using MapStruct together with Lombok under Quarkus

I’m following the guide at the MapStruct blog and having trouble using this 3 technology together. I’ve been trying several approaches from the MapStruct docs, bug-reports, posts from here but in every case I end up receiving the following exception during the build. Have anyone successfully used …

Lombok getter/setter vs Java 14 record

I love project Lombok but in these days I’m reading and trying some of the new features of java 14. Inside the new capability, there is the record keyword that allows creating a class with already built-in the following functionality: constructor, private final fields, accessors, equals/hashCode, getter…

Does Lombok toBuilder() method creates deep copy of fields

I am using toBuilder() on an object instance to create a builder instance and then build method to create new instance. The original object has a list, does the new object has reference to same list or a copy of it? Will lib2 books refer to same list as lib1 books ? Answer Yes, the @Builder(toBuilder=true) an…

Lombok annotations has no effect

I have a spring boot app 2.0.5.RELEASE with a lombok dependency for version 1.18.2 with scope set to provided. An exmaple: In that case I’m getting an error as repository field is null. When I remove lombok @AllArgsConstructor and put it directly: Then it works, a proper component is injected in the rep…

How to override Lombok Setter methods

I’m using lombok in my project and generation Setters and Getters using @Setters and @Getters annotations on top of POJO class. I’m trying to override setters method of a property but it’s not working I want to check if JSON property is Empty or Null i want to set default value in Setter met…

Why is Lombok @Builder not compatible with this constructor?

I have this simple code: First I was using only the @Builder Lombok annotation and everything was fine. But I added the constructor and the code does not compile any more. The error is: So I have two questions: Why is Lombok @Builder not compatible with this constructor? How do I make the code compile taking …