I am using Spring-boot 2.1.6
and i have DTO
:
@AllArgsConstructor
@Builder
@Data // setters, getters, others
@NoArgsConstructor
public class ExampleDto {
private String fieldOne;
private String fieldsTwo;
}
Do i really need that many Lombok
annotation here? Which will Jackson
use by default when deserializing over HTTP
connection (microservices)?
I guess only NoArgsConstructor
+ setters
would be fine? Or does it use reflection
and only providing no-arg-constructor is fine?
Is there an option to change behaviour of Jackson
to use only AllArgsConstructor
or builder
?
I saw in logs that my app uses Jackson
to deserialize stuff.
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.8.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
Edit:
My question is different from Can't make Jackson and Lombok work together cause it works.