Questions tagged [lombok]

Project Lombok is a tool for reducing boilerplate code in Java through annotations and compile time code generation.

Filter by
Sorted by
Tagged with
0 votes
0 answers
9 views

How to make ORM instances visibile in the / page of a Spring {Boot | Data JDBC} + Thymeleaf TE webapp

please excuse my poor English :) I'm writing a Spring Boot + Spring Data JDBC webapp + Thymelaf TE + Lombok. As usual I have model classes, repository classes and controller classes for every DB ...
mORA's user avatar
  • 1
0 votes
2 answers
54 views

How can I add methods to a Java class at compile time using annotations or similar techniques, similar to Lombok?

I'm looking for a solution to dynamically add methods to a Java class during compile time, similar to how Lombok operates with annotations. Specifically, I want to automate method generation based on ...
saba artkmeladze's user avatar
0 votes
0 answers
25 views

Maven build fails with error LifecycleExecutionException and MojoExecutionException and java.lang.StackOverflowError

mvn clean install gets success with java (jdk1.8.0_201) but fails to build with java (C:\Program Files (x86)\Amazon Corretto\jdk1.8.0_392). I am trying this with Corretto8 to deploy using aws ...
Jalandar R's user avatar
1 vote
2 answers
80 views

Spring @Valid annotation on constructor not working. Best practice to validate Dto

Today I was looking for a way to validate a DTO that I have to return to the FE. I thought could be a good idea to create the constructor with the @Valid annotation from jakarta.validation package ...
Alexxxx's user avatar
  • 29
0 votes
1 answer
22 views

java : should data of @Id field in entity be unique to one another?

I'm curious whether should the field with @Id annotation be unique to one another or not. The reason why i'm asking this is that I'm creating an entity with three fields to act as a primary key (but ...
ChangshinKang's user avatar
0 votes
0 answers
31 views

Suppress checkstyle for lombock's val using SuppressionXpathFilter

I am using lombok's val to specify the final variables in my code. The checkstyle rule for FinalLocalVariable reports any val variable as non-final. I am trying to write a custom suppress.xml to ...
meldevep's user avatar
  • 593
1 vote
2 answers
36 views

Lombok not compiling an abstract generic superclass

I have this class: @SuperBuilder public abstract class EventFinder<EventType> { private final String accountId; public abstract List<EventType> find(); public static abstract ...
Kfir Doron's user avatar
0 votes
0 answers
35 views

QClasses not generated for Entities with Java 17

This question has been shown up on stackoverflow for multiple times, but it doesn't solve my issue, I am using Java 17 with queryDSL 5.0 and Spring boot 3.2.0 with lombok 1.18.30 and gradle 7.4.1 ...
Vandit Shah's user avatar
0 votes
3 answers
62 views

how can we create the same hashcode value for 2 identical objects using lombok?

I am trying the singleton design pattern. I know that service1 and service2 have the same hash values when we manually implements and overrides the equals and hashCode methods. But I want to do this ...
expelliarmus's user avatar
0 votes
0 answers
30 views

lombok annotation and test

I use Spring Boot 3 with Intellij and Lombok. In my build.gradle I have dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework....
robert trudel's user avatar
-1 votes
0 answers
23 views

While Using lombok and JPA annotation Getting org.hibernate.id.IdentifierGenerationException [duplicate]

Is it possible to use Lombok feature for a class which uses @Entity and @Table Annotation Here is the sample class.** package test.model; import jakarta.persistence.Entity; import jakarta.persistence....
Sreenivas M's user avatar
-1 votes
3 answers
71 views

Constructor base dependency injection not working?

It's my first time encountering this error that says `Description: Parameter 0 of constructor in com.team.zah.blog.service.Impl.PostServiceImpl required a bean of type 'com.team.zah.blog.repository....
devash's user avatar
  • 13
0 votes
0 answers
29 views

Lombok @RequiredArgsConstructor with @Value

Is it possible to use @RequiredArgsConstructor with @Value parameter Currently using @Value parameter inside constructor to get the value from properties. public SomeService(RestTemplate restTemplate,...
Rivo's user avatar
  • 3
-1 votes
5 answers
145 views

Issue with Lombok not generating getters and setters or constructor and even @Data in Spring Boot project

I utilized Spring Boot to initialize my project, and indeed, I included the Lombok dependency through Spring Boot and configured the Lombok plugin as follows: And The IDE I use is Eclipse <?xml ...
Kelvin Huynh's user avatar
0 votes
0 answers
27 views

jsonIgnore annotation is not working with Data annotation in lombok

I am trying to ignore some fields to be a part of REST template call. I am using lombok @Data and trying @JsonIgnore but I see JsonIgnored field in the request body. code sample: @Data @...
Hitesh Kumar's user avatar
0 votes
0 answers
70 views

Lombok methods don't get generated in classes while building spring boot module using them

Springboot 3.1.2 Java 17 I have a parent project containing two modules Parent pom: <project ...> <groupId>com.demo</groupId> <artifactId>prnt</artifactId> &...
Stack Spring's user avatar
-3 votes
1 answer
59 views

Does Lombok's @UtilityClass support static imports? Are you sure it doesn't?

Lombok's doc says @UtilityClass doesn't provide support for static imports: Due to limitations in javac, currently non-star static imports cannot be used to import stuff from @UtilityClasses; don't ...
JoreJoh's user avatar
  • 321
2 votes
0 answers
2k views

How to fix NoSuchFieldError 'com.sun.tools.javac.tree.JCTree

How can i fix 'java: java.lang.NoSuchFieldError: Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid'' error? When I research the problem, ...
Bktedr's user avatar
  • 41
2 votes
1 answer
142 views

Lombok @SuperBuilder - convert an object from one child class to another, preserving the parents' fields

I need to convert an instance of one class to a "sibling" class (both inheriting from the same parent) without explicitly setting common/parents' fields. The goal is to make this "...
MK_Dev's user avatar
  • 3,311
-1 votes
1 answer
38 views

Inhertance class annotated by @Builder

I need to inherit a super class from a dependency that has @Builder annotation (I can't modify this class) at the same time I want my sub class to have the builder pattern. I tried to use the @builder ...
Sara Selim's user avatar
0 votes
1 answer
119 views

Bug with @AllArgsConstructor in Lombok?

I have the following error when starting my spring boot application: Parameter 17 of constructor in be.mypackage.dataimport.soft99.transformers.visit.VisitTransformer required a bean of type 'java....
The_Unknown's user avatar
0 votes
2 answers
89 views

Ignore null value when using lombok superbuilder

I have a situation using Lombok SuperBuilder to create a constructor for my class Is there anyway I can create an object using builder without it creating a null value? @Data @SuperBuilder public ...
Clueless_Coder's user avatar
-1 votes
1 answer
53 views

Getting null values when binding values from an HttpRequest to an Object in Springboot

I've created a Webhook server that's accepting a POST request from a 3rd party (Twilio) for their message delivery call-backs and I'm de-serializing it into an object. The pojo object has the same ...
Mehsum Naqvi's user avatar
1 vote
1 answer
45 views

ObjectMapper behaving weirdly when mapping "is" prefixed Boolean field

I have a Boolean field in the request body of an API, named "isSafe". This field is mapped to my Pojo class using ObjectMapper. If I send "safe" in the request then it fails and I ...
Amit Kumar's user avatar
0 votes
0 answers
59 views

ObjectMapper maps Boolean field with "is" prefix to same name field without "is" prefix after some time

I have a Boolean field in the request body of an API, named "isSafe". This field is mapped to my Pojo class using ObjectMapper. If I send "safe" in the request then it fails and I ...
Amit Kumar's user avatar
0 votes
0 answers
41 views

Lombok wont copy @JsonFormat annotation to getter method

I think it is a bug on Lombok library or I am missing something really stupid here. I have a pojo class @Setter @Getter @RequiredArgsConstructor public class AnnounceV2 { @JsonProperty("postedAt&...
Rafael Lima's user avatar
  • 3,218
70 votes
3 answers
48k views

Compilation error after upgrading to JDK 21 - "NoSuchFieldError: JCImport does not have member field JCTree qualid"

After upgrading to JDK 21, I have the following compilation error in my Spring Boot project: Fatal error compiling: java.lang.NoSuchFieldError: Class com.sun.tools.javac.tree.JCTree$JCImport does not ...
Honza Zidek's user avatar
  • 11.3k
0 votes
1 answer
26 views

Generic Parent Class Extender

I have 2 parent classes, and a child class, and I am trying to make this flow work (Please note, I know there are other workarounds and whatnot, but I am not trying to initialize the variable in a ...
Jason Chan's user avatar
0 votes
1 answer
69 views

Omitting a parameter from @RequiredArgsConstructor that is set through @Value

Suppose there's a class in a Spring Boot project: @RequiredArgsConstructor @Component public class A { @Value("${a.category:RANDOM}") private final String CATEGORY; private ...
IceMajor's user avatar
  • 162
0 votes
0 answers
33 views

Lombok is not generating getter and setter in eclipse ide after maven install

in my spring boot project i am using lombok dependency , maven install working fine , but lombok not genrating getter and setter in eclipse. i tried to do maven install the lombok dependency are ...
Subhadip De's user avatar
0 votes
0 answers
41 views

Back referencing object with mapstruct

I have these entities @Entity @Table(name = "author") @NoArgsConstructor(access = PROTECTED) @AllArgsConstructor(access = PROTECTED) @Setter @Getter @SuperBuilder @JsonInclude(JsonInclude....
Alex P.'s user avatar
  • 3,093
0 votes
2 answers
254 views

cannot find symbol with Lombok 1.18.26 when JDK upgraded to JDK17 in multi module maven project

I was using Lombok with JDK8 and everything was working fine. However, when I tried upgrading to JDK17, compilation fails with error error: cannot find symbol [ERROR] symbol: class Builder cannot ...
Sammidbest's user avatar
0 votes
1 answer
28 views

Customize Lombok equalsAndHashCode() on list attribute

Is there a way to customize the Lombok equalsAndHashCode() on list attribute? I have a subclass that looks like so: public class subClass extends superClass { private List<Long> ids; For 2 ...
EzyHoo's user avatar
  • 313
0 votes
0 answers
95 views

SpringDoc Open API MVC Starter not showing fields of class annotated with Lombok @Data?

I have setup a new Spring Boot 3 project with the OpenAPI starter dependency <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-...
tomaytotomato's user avatar
0 votes
1 answer
30 views

NotNull annotation preventing builds in spring boot application

I am trying to run a spring boot app. I have a model class(Category) and a service class(CategoryService) corresponding to the model Category.java @Data @Entity public class Category implements ...
plbit's user avatar
  • 415
0 votes
0 answers
177 views

cannot find symbol issue for maven multimodule project

while building the module I am getting symbol not found issue even though getters setters are there and I am using lombok. In moule1 all entites and DTO's are there I am able to acces those entites ...
Sagar Chidre's user avatar
-1 votes
1 answer
57 views

NullPointerException when using @PreAuthorize in Spring Boot [duplicate]

I am working on a Spring Boot project where I have implemented Spring Security to manage JWT authentication. I have a ProductController with a ProductService autowired in it. When I add the @...
Smaillns's user avatar
  • 2,673
0 votes
3 answers
56 views

How to convert to an Object by handling null inputs

How to convert to an Object by handling null inputs, is there a way to check for null inputs and return null without writing the if check for null; public static Image convert(SyndImage syndImage) { ...
user352290's user avatar
0 votes
1 answer
37 views

When I use a custom annotation processor, the Lombok fails when I run mvn install

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"...
CoderL's user avatar
  • 1
0 votes
0 answers
45 views

Error 'Constraint defines multiple validators for the type java.util.UUID", despite using only a single validator

I've discovered a weird Spring bug or at least a strange behavior when investigating a bug in our project. At runtime, whenever somebody called one particular endpoint, they got back error 500 with ...
Wired5149's user avatar
0 votes
1 answer
443 views

why compile error when upgrade lombok to 1.18.28 with jdk17?

I'm upgrading the Java version to 17. Here is the stacktrace. Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private com.sun.tools.javac.processing....
tony's user avatar
  • 13
1 vote
1 answer
36 views

How to do Java inheritance/implementing repeating private/protected fields?

I am trying to implement a java class for all entities of database. Every entity - class with private fields where all of them contains "created_at" and "updated_at" private fields....
pro-frontend's user avatar
-1 votes
2 answers
67 views

How does @Data creates Constructor

ok so i read a lot of questions here and still couldn't understand how this works and gives no error. by my logic @Data creates a RequiredConstructor if it has final fields. @Entity needs a ...
alpha's user avatar
  • 21
1 vote
1 answer
68 views

How to use Lombok's RequiredArgsConstructor with Nullaway?

We're trying to add "Nullaway" (https://github.com/uber/NullAway) to our repo. This is a tool that assumes everything not annotated with @Nullable can't be null and enforces it in compile ...
user1700773's user avatar
0 votes
0 answers
37 views

Integrity constraint orHash code issue when saving a many to many relation in jpa

I use spring boot 3.1.3, lombok and jpa I try to save a many to many relation @Data @Entity @Table public class Pub { @Id @SequenceGenerator(name = "SEQ_PUB", sequenceName = "...
robert trudel's user avatar
0 votes
1 answer
194 views

Update a different variable in the class with Java Lombok Builder

I have the following class @Builder public class User { private String userName; private String email; private String device; private String deviceType; } I want to set the value ...
ragingDino's user avatar
0 votes
1 answer
256 views

Lombok Annotations and inheritance

I am currently developing a project in Spring boot and I am having some issues in inherited classes. The issues are coming from the fact that I use annotations in the abstract parent class (such as @...
learningProgrammer's user avatar
-2 votes
1 answer
271 views

Spring Data JDBC: Error - Cannot set property id because no setter, no wither, and it's not part of the persistence constructor

I am a beginner in spring and trying to use Spring Data JDBC to persist data. I have made the necessary changes to the Repository interfaces by extending them with Repository/CrudRepositoy. Also, for ...
Raghav Kavimandan's user avatar
4 votes
1 answer
560 views

About project Lombok's future [closed]

I've been using Lombok and am pretty happy with it, enabling my laziness to avoid writing boilerplate code. But there have been some concerning information about Lombok like: I read here that Lombok ...
paratrooper's user avatar
0 votes
1 answer
40 views

Eclipse/ SpringSTS Code assist very slow with Spring and Lombok.jar

So, first of all this happenes only with Java project where we use lombok.jar. The project has more than 1900 Java files. Now the problem comes when I hit [CTRL+SPACEBAR] on the keyboard, or when I ...
Siva's user avatar
  • 628

1
2 3 4 5
49