문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 다음 판 양쪽 다음 판 | ||
java:lombok [2021/02/02 18:48] kwon37xi [1.16.20 @ConstructorProperties] |
java:lombok [2021/02/10 23:05] kwon37xi [1.18.4 field annotation 들이 getter/setter 로 복제됨] |
||
---|---|---|---|
줄 88: | 줄 88: | ||
* 이 시점 이후부터 '' | * 이 시점 이후부터 '' | ||
* [[https:// | * [[https:// | ||
- | * 기본 생성자가 없을 경우, [[java: | + | * 기본 생성자가 없을 경우, [[java: |
- | * '' | + | * '' |
> BREAKING CHANGE: lombok config key lombok.anyConstructor.suppressConstructorProperties is now deprecated and defaults to true, that is, by default lombok no longer automatically generates @ConstructorProperties annotations. New config key lombok.anyConstructor.addConstructorProperties now exists; set it to true if you want the old behavior. Oracle more or less broke this annotation with the release of JDK9, necessitating this breaking change. | > BREAKING CHANGE: lombok config key lombok.anyConstructor.suppressConstructorProperties is now deprecated and defaults to true, that is, by default lombok no longer automatically generates @ConstructorProperties annotations. New config key lombok.anyConstructor.addConstructorProperties now exists; set it to true if you want the old behavior. Oracle more or less broke this annotation with the release of JDK9, necessitating this breaking change. | ||
줄 102: | 줄 102: | ||
<code java> | <code java> | ||
- | @JsonProperty(" | + | @JsonProperty(" |
- | private int yyy; | + | private int isXxx; |
-> 진짜 생성은 | -> 진짜 생성은 | ||
- | @JsonProperty(" | + | @JsonProperty(" |
- | private int yyy; | + | private int isXxx; |
- | public void setYyy(int yyy) { | + | public void setXxx(int xxx) { |
- | this.yyy = yyy; | + | this.isXxx = xxx; |
} | } | ||
- | -> 이로 인해서 JSON 에 XXX, yyy 두개의 필드가 존재하게 됨. | + | -> 이로 인해서 JSON 에 '' |
</ | </ | ||
=== 신 버전 Lombok === | === 신 버전 Lombok === | ||
<code java> | <code java> | ||
- | @JsonProperty(" | + | @JsonProperty(" |
- | private int yyy; | + | private int isXxx; |
-> 진짜 생성은 | -> 진짜 생성은 | ||
- | @JsonProperty(" | + | @JsonProperty(" |
- | private int yyy; | + | private int isXxx; |
// 아래 setter 에도 @JsonProperty 가 붙어버림 | // 아래 setter 에도 @JsonProperty 가 붙어버림 | ||
- | @JsonProperty(" | + | @JsonProperty(" |
- | public void setYyy(int yyy) { | + | public void setXxx(int isXxx) { |
- | this.yyy = yyy; | + | this.isXxx = isXxx; |
} | } | ||
</ | </ | ||
- | * 해결책은 getter/ | + | * 해결책은 getter/ |
+ | * 여기서 진짜 문제는 Jackson 이 '' | ||
+ | * Java Bean/ | ||
+ | * 그런데 많은 사람들이 필드 이름을 지을 때 '' | ||
+ | * 따라서 이 문제는 **is로 시작하는 boolean 필드** 에서만 발생한다. | ||
+ | |||
+ | === Boolean 필드 문제 === | ||
+ | * [[https:// | ||
+ | * '' | ||
+ | * '' | ||
+ | * 따라서 '' | ||
+ | * '' |