Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpringBoot 3.4.4: Lombok Annotation Processing isn't working as expected #44950

Closed
hrajpal96 opened this issue Mar 30, 2025 · 5 comments
Closed
Labels
status: invalid An issue that we don't feel is valid

Comments

@hrajpal96
Copy link

hrajpal96 commented Mar 30, 2025

Lombok Data annotation isn't processing getters and setters for Entity class in controller endpoint when returning response list with SpringBoot 3.4.4 with the default configurations used from SpringInitializr

  1. Controller class:
    @GetMapping("/products") public List<Product> getProducts(){ return productService.getAllProducts(); }

  2. pom.xml
    https://gist.github.com/hrajpal96/d5e88d1a7c435292a51805fa44905c6d

The controller uses service which uses an extension of JpaRepository, the results are fetched fine till controller but are returned as empty responses list with the expected row count
[{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 30, 2025
@bclozel
Copy link
Member

bclozel commented Mar 30, 2025

Please share a minimal sample application as the issue is probably not in the POM itself.
Thanks!

@bclozel bclozel added the status: waiting-for-feedback We need additional information before we can continue label Mar 30, 2025
@hrajpal96
Copy link
Author

Hi there,
I have updated the test code with readme file for the application run steps, let me know if you need any further details:
Repository link: https://github.com/hrajpal96/e-commerce-sb3.4.4-test
Thanks!!

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Mar 31, 2025
@mhalbritter
Copy link
Contributor

mhalbritter commented Mar 31, 2025

Hey,

I can't reproduce it.

  1. start postgres with docker: docker run --rm --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 postgres

use this config:

spring.datasource.username=postgres
spring.datasource.password=mysecretpassword
spring.jpa.hibernate.ddl-auto=update
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.jpa.show-sql=true
spring.jpa.open-in-view=false
  1. start app (i used intellij with enabled Lombok processing and also mvn spring-boot:run), create the schema
  2. Insert data into postgres
  3. Query localhost:8080/api/products:
> curlie :8080/api/products
HTTP/1.1 200 
Content-Type: application/json
Transfer-Encoding: chunked
Date: Mon, 31 Mar 2025 08:52:59 GMT

[
    {
        "id": 1,
        "name": "n",
        "description": "d",
        "brand": "b",
        "price": 1.50,
        "category": "c",
        "releaseDate": "2025-03-31T08:52:07.000+00:00",
        "productAvailable": true,
        "stockQuantity": 1
    }
]

@mhalbritter mhalbritter added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Mar 31, 2025
@mhalbritter
Copy link
Contributor

mhalbritter commented Mar 31, 2025

If you used an IDE to run the application, make sure that annotation processing is enabled, otherwise Lombok doesn't generate the getters / setters.

My guess is that mvn spring-boot:run works for you, too.

@hrajpal96
Copy link
Author

hrajpal96 commented Mar 31, 2025

yes, my bad seems to be some issue which is not enabling annotation processing despite it being ticked.
As you mentioned trying out with mvn spring-boot:run works fine.
Thank you!

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Mar 31, 2025
@mhalbritter mhalbritter closed this as not planned Won't fix, can't repro, duplicate, stale Mar 31, 2025
@mhalbritter mhalbritter added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

4 participants