Questions tagged [lombok]

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

1
vote
1answer
22 views

spring boot fails to start— define a bean of type 'TopicRepository' in configuration

I was following this JavaBrains tutorials of Spring Boot. My project structure is as follows: CourseApiApp.java: @SpringBootApplication @ComponentScan(basePackages = { "com.bloodynacho.rishab....
0
votes
1answer
27 views

Explanation on the usage of Lombok's @NonNull

What is the difference in the usage of @NonNull in the following two cases: Case 1: class MyClass { @NonNull private String name; @Builder MyClass(String name) { this.name = ...
1
vote
1answer
47 views

Lombok : constructor is undefined

I am using lombok in a spring project and building with gradle. All of the things were woking fine before. suddenly some errors have started coming. Error is "Constructor(Constructor name) is ...
0
votes
1answer
38 views

Generating equals/hashCode implementation but without a call to superclass, even though this class does not extend java.lang.Object

I am getting below error while using lombok and even it doesn't allow me to set id and version while creating student instance. Multiple markers at this line - overrides com.example.demo.IModel....
0
votes
3answers
65 views

Guice Configuration Error No implementation was bound

I am trying to keep a singleton AmazonSNS to access an SNS. I have written a module for SNS (only one SNS is added currently) and an accessor to publish the message. My code is as follows: public ...
3
votes
1answer
65 views

Named parameter constructor in groovy and lombok @Value

I have following object annotated with @Value from Lombok: @Value public class Foo { private final boolean bar; private final boolean baz; private final boolean boo; } I try to ...
1
vote
0answers
18 views

Lombok's lombok.copyableAnnotations not working with Jackson annotations

I'm trying to make use of Lombok's new copyableAnnotations feature in order to have Jackson annotations like @JsonIgnore and @JsonValue copied to generated getter/wither methods. This blog seems to ...
1
vote
1answer
45 views

Lombok: Equals for string instance variables in subclass

I recently stumbled across Lombok and wanted to test it, when I ran into this slight problem. Suppose I have import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import ...
1
vote
0answers
68 views

Mapstruct problem: Unknown property error, but property is present

I'm using: spring-boot 2.1.5.RELEASE mapstruct 1.3.0.Final lombok 1.18.8 and I'm trying to map two objects, Model and DTO: DTO ClientDto - gotten from nesux repository as a dependency Model Client ...
0
votes
0answers
13 views

Enabling Annotation Processing and Intellij Lombok

I am using Intellij 2019.1. I have a lombok dependancy in my application. I have enabled annotation processing in IntelliJ Preferences. I still get a compilation error for all the Lombok Annotations. ...
0
votes
2answers
28 views

Lombok installation in Spring Tool Suite 4 for Windows

To install Lombok on one of my spring boot project on STS 4 in Windows 10 OS, I did the following steps: Added the lombok gradle dependency to build.gradle: compile 'org.projectlombok:lombok' Then ...
0
votes
2answers
89 views

How to access application.yml properties in Spring 1.5.9

I'm spinning my wheels on this. Here is a simple Spring Boot app. I'm trying to use a yaml properties file, but I can't seem to get it to find the properties file or let me access the values in it....
2
votes
4answers
86 views

Lombok @getter not working in src/test/java package

I have upgraded my jdk from 10 to 11 with all the dependencies updated to use the latest versions. When compiling using gradle wrapper it is throwing following error symbol: method getId() ...
0
votes
2answers
59 views

Lombok @Builder generated class in a Gradle module not found in other module

I want to add Lombok to a Gradle multi-module project, but I'm having a hard time trying to configure it. Was reading the documentation and multiple pages, however I'm not able to make it work when it ...
1
vote
2answers
26 views

How can we auto trim the property values in auto generated setters (using @Data )using lombok in a POJO?

I use lombok v1.18.6 in my pojo class. Also using @Builder and @Data annotations for auto generated setters/getters and Builder. I need to trim the property values when setting the values in automated ...
1
vote
0answers
17 views

Activating Lombok annotation processor with Gradle

I like using Lombok, but it requires enabling annotation processor in IDEs settings. Because developers use different IDEs and CI/CD has it's own compilation flow, plus I would really like to avoid ...
0
votes
1answer
21 views

How can I unit test my log messages using testng

We use testng as out testing framework. We also use Lombok @Log4j2 to instantiate our log objects. I need to test some code that it logs certain messages under certain conditions. I have seen ...
0
votes
1answer
24 views

Lombok generating constructor without @Nonnull annotation

I'm using Lombok for generating my POJOs. I've got a bunch of fields annotated with javax.annotation.Nonnull and I expect this annotation to be transferred to the constructor automatically. However, ...
0
votes
1answer
53 views

lombok & jackson do not work together with openjdk12

Reproducible here: I used to have java 8.x all was working ok. both open jdk and Oracle. Once JDK & and Oracle JDK is upgraded, I got exceptions from the jackson. Error:(10, 1) java: ...
0
votes
0answers
31 views

Unable to use method toBuilder() (undefined)

I'm trying to use Lombok in my GWT application. I have added the dependency with Gradle. There is no warnings or errors in the code when I use @Builder(toBuilder = true) or .toBuilder().build(). But ...
0
votes
2answers
33 views

Lombok SLF4J impl inheritance issues

I'm facing an issue with Lombok in my multimodule maven project. I have two classes : @Slf4j public class Parent {} @Slf4j public class Child extends Parent { public void m() { log.debug(...
1
vote
2answers
65 views

Applying Lombok plugin to Gradle causes “Could not find any public constructor” error

I'm trying to apply the Lombok Gradle plugin to my project: plugins { id 'java' id 'application' id "io.freefair.lombok" version "3.6.4" } However I get this error when running the build:...
0
votes
1answer
30 views

constructor parent in parent class cannot be applied to given types error

I want to extend a parent class say: @Getter @Builder public class Parent { @Builder.default private final int maxCats = 1; @NonNull private final String catName; } I am proceeding as follows, @...
0
votes
1answer
14 views

How to ignore [email protected] for Jacoco?

I have used [email protected] to: generate a private constructor make the class final make all fields in the utility class static And Jacoco does not cover Lombok generated code. If I explicitly ...
1
vote
1answer
74 views

Lombok excluding field with @ToString.Exclude is not working

I'm using Lombok to remove boilerplate code. I'm attempting to print out an entity to the console but I'm getting a StackOverflowError. The entity has a bidirectional relationship with another ...
-1
votes
0answers
28 views

Java and Lombok - Specifying the fields to initialize after call to the super constructor defined with @RequiredArgsConstructor

I have a maven project developed with Spring Boot. Defining the annotation @RequiredArgsConstructor form Lombok in the class Activity, creates the necessity to initialize fields of the @Service class ...
1
vote
0answers
38 views

Lombok is not being recognized in LibGDX project

I'm working on libGDX project and I want to use Lombok. I followed this short tutorial about using lombok in libGDX projects but unfortunately it does not working. Situation looks like this - ...
0
votes
1answer
42 views

IDE does not show getters and setters generated by Lombok for a Jackson annotated class

I use Intellij Idea 2019.1.2 community edition for my Java projects. I have a Jackson 2.9.6 annotated POJO which uses Lombok 1.18.0 to generate the getters and setters for the pojo. I have some "...
2
votes
1answer
67 views

Spring mapper with Java Map

I've been struggling with the following issue for a few hours now, and I can't figure it out how to make it work: Spring mapper, in order to convert DB response to DTO: @Mapper(componentModel = "...
2
votes
1answer
33 views

@Builder.Default in base class not working?

I'm writing classes with lombok annotations and got a problem: @AllArgsConstructor @Data public abstract class Base { protected static final int a = 1; @Builder.default protected int b = ...
1
vote
1answer
21 views

lombok builders does not care of restricted set of method/constructor-properties

I have 3 builder methods: @Builder(builderMethodName = "b1") public static User builder1(String name, String age) { return User.b3().name(name).age(age).build(); } @Builder(builderMethodName = "...
0
votes
2answers
63 views

LOGGER.info and LOGGER.debug showing in red with cannot resolve method

Fixed I tried reinstalling the plugin but that didn't work so i completely cleared my inteljii idea and installed it again and it seems to be working. Not sure what the issue was really. ...
0
votes
1answer
53 views

Lombok Getter/Setter are not being accessed in Netbeans 11

Recently I have started using Netbeans(NB) 11. Previously I used NB 8.2. I opened my NB 8.2 projects in NB 11 where I have used Lombok. I noticed that NB 11 is giving red marks where i have used ...
0
votes
2answers
81 views

Lombok @Builder not recognised by IntelliJ

I updated IntelliJ IDEA to version 2018.2.7, and Lombok's @Builder annotation is not recognised anymore. The project already had Lombok annotations, which worked fine with previous (2017...) version ...
1
vote
2answers
80 views

Lombok not working with Android Studio 3.4

After updating android studio to 3.4, am facing issues with lombok plugin. Though inside model class, annotations are recognised and showing properly, in activity all getter and setter functions i ...
1
vote
2answers
112 views

Java Lombok - best practice?

I have inherited a class with the following Lombok annotations: @Getter @Setter @Builder @NoArgsConstructor @AllArgsConstructor @ToString @EqualsAndHashCode public class PricingAndCosting { //...
5
votes
0answers
58 views

Why does @EnableWebMvc break the JSON deserialization?

In my sample application I have a simple @RestController controller: package app.springtest.api.book; import app.springtest.service.BookService; import lombok.RequiredArgsConstructor; import lombok....
1
vote
1answer
37 views

Should I instantiate a field when I use lombok

I use lombok to omit the getter and setter of a java bean. Here is a example from the book "Spring in Action 5 edition" A java bean: @Data public class Taco { @Size(min=1, message="You must ...
2
votes
1answer
39 views

How to do Lombok compound or aggregate building

It seems like an obvious requirement, so I'm surprised that there aren't any accessible examples, but I have a class with a Lombok builder annotation on it, which contains a class that also has a ...
1
vote
1answer
41 views

Lombok @EqualsAndHashCode with Scala - case class cannot inherit Java class

I have a Java class, with a lombok generated equals and hashCode @EqualsAndHashCode @AllArgsConstructor public class MyJavaClass { private final String foo; } And a Scala case class which ...
1
vote
0answers
34 views

How to not create beans based on other beans?

I have a configuration class in which it's annotated with @Configuration. 2 beans get created. These beans are used annotated with @Profile hence if the profile is set to prod, then it'll get ...
2
votes
1answer
34 views

@Mapping with custom source and target variable is not working as expected when target has variable with same name as source

I have below Source and Target classes, i am using lombok for generating getters and setters public class Target { private String name; private String newName; } public class Source { ...
3
votes
1answer
50 views

Find usages of lombok generated getter/setter in Intellij

I have a field with lombok annotation (@Setter) and I am looking for an easy way to find usages of the auto generated setter. When I put the cursor on the @Setter annotation and run Find usages (Alt+...
0
votes
0answers
20 views

Integrate Lombok with OpenCSV and JAXB

I am trying to write a code to convert csv to bean using opencsv and xml to bean using jaxb. I tried using lombok. The getters are not getting resolved even after lombok has generated them. ...
2
votes
1answer
45 views

Using Lombok in immutable Request class

Welcome, I've created simple Rest Controller: @RestController public class MyController { @PostMapping(value = "/cities", consumes = "application/json", produces = "application/json") ...
2
votes
0answers
36 views

How does static factory method infer generics?

Going through this doc: https://projectlombok.org/features/constructor I came across the following: "the generated constructor is always private, and an additional static factory method that wraps ...
0
votes
1answer
54 views

Is it possible to use Lombok @Builder, starting from static method?

I want Lombok to take care of my builder API, while also having a constructor to start with. I started out with a constructor on the @Data class combined with @Builder(toBuilder = true), but that ...
0
votes
1answer
91 views

Lombok builder inheritance with Complex Class Structure

I've read other questions regarding lombok's builder and inheritance but none of the solutions have worked. Using Lombok version 1.18.4 and Java 11. I'm trying to inherit the parent builder while ...
0
votes
2answers
86 views

java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.codegen.CodeStream.newArray

Environment jdk1.8 spring-tool-suite4 Issue cannot debug the project because of the eclipse java problem. Keywords codegen.TypeAnnotationCodeStream.newArray Detail Problems occurred when invoking ...
0
votes
1answer
79 views

Spring boot 2 lombok:jar:2.6.7 is missing, no dependency information available

This is my pom.xml it is generated from start.spring.io for M2 spring-boot version. This is why the maven spring repositories are added. But the dependency cant be found . <?xml version="1.0" ...