Annotations

  • @JoinColumn: insertable & updatable fields control whether the annotated field can be included in INSERT and UPDATE query.
  • @Modifying: allow query methods annotated with @Query can modify data.
  • @RepositoryRestResource: exported field hides methods in repository (send request will return 405 Method Not Allowed).
  • @NoArgsConstructor will generate a constructor with no parameters. If this is not possible (because of final fields), a compiler error will result instead, unless @NoArgsConstructor(force = true) is used, then all final fields are initialized with 0 / false / null.
  • @RequiredArgsConstructor generates a constructor with 1 parameter for each field that requires special handling. All non-initialized final fields get a parameter, as well as any fields that are marked as @NonNull that aren’t initialized where they are declared.
  • @AllArgsConstructor generates a constructor with 1 parameter for each field in your class. Fields marked with @NonNull result in null checks on those parameters.
  • Thêm @JsonIgnoreProperties(ignoreUnknown = true) vào các model hứng dữ liệu trả về từ API của các bên thứ 3 nhằm ignore các field không tồn tại trong model.

Resources