Lombok: Spring Data REST JSON body does not show basic properties

Created on 15 Jul 2015  路  9Comments  路  Source: projectlombok/lombok

_Migrated from Google Code (issue 814)_

Most helpful comment

I just ran into this issue.

Running from IntelliJ using the "Run" command on the Spring Boot Application results in the bytecode not being manipulated. It actually fails to run at all if you reference a generated setter anywhere in the code. This is deceiving because when you're using the IntelliJ Lombok plugin, the code does not show any errors.

Running via command line, or the IntelliJ Gradle integration with the bootRun task works fine.

This makes sense since Gradle, not Spring, is responsible for kicking off the Lombok code generation.

All 9 comments

:bust_in_silhouette: anupambhatt   :clock8: May 11, 2015 at 11:34 UTC

What steps will reproduce the problem?

  1. Create a Spring data REST project.
  2. Include lombok's @ Data annotation on entity classes
  3. execute the project and see the JSON output from Spring Data REST.

What is the expected output? What do you see instead?
It is expected that all basic properties (the entity field values) will be populated, however, the properties are missing from the Spring Data REST output (when queried through a REST call).

What version of the product are you using? On what operating system?
version: 1.14.8 on Mac

Please provide any additional information below.
Please reach out to me if unable to reproduce the issue. Can provide sample code.

_End of migration_

@lombokissues
I confirm the bug on version 1.16.6

Using:

  • spring-data-rest 2.6.1
  • spring-boot 1.5.2
  • spring-boot-starter-data-rest 1.5.2

To reproduce:
build.gradle
Repository
Entity

Unless getters and setters are defined manually, JSON responses won't contain the entity's fields.

Let me know if I'd better link a repo with the sample application.

Thanks!

will this issue be fixed?

I don't know. It helps if we would have some pointers on where to start.

Both Reinier and I are not spring users, let alone experts.

I checked the decompiled class and getters and setters weren't created.
I'm using
IntelliJ 2017.1.3
Gradle 4.2.1
Lombok 1.16.14
Java 8
Spring 1.5.7

At the end I moved to maven and everything work fine. I hope these data can help you to fix the issue

For me it worked with Java 9 and the Lombok edge Version 1.16.9 - both command line and IntelliJ
OS X 10.13.1 - Spring Boot 1.5.8 - Java 9.0.1 - Gradle 4.3.1 - IntelliJ 2017.2

compile files('./lombok-edge.jar')

I just ran into this issue.

Running from IntelliJ using the "Run" command on the Spring Boot Application results in the bytecode not being manipulated. It actually fails to run at all if you reference a generated setter anywhere in the code. This is deceiving because when you're using the IntelliJ Lombok plugin, the code does not show any errors.

Running via command line, or the IntelliJ Gradle integration with the bootRun task works fine.

This makes sense since Gradle, not Spring, is responsible for kicking off the Lombok code generation.

Related issue raised in spring-boot project

Attached code for reference/help reproducing issues around spring-boot
lsbdr.zip

Was this page helpful?
0 / 5 - 0 ratings