Annotation Interface JsonApiId


@Target({METHOD,FIELD}) @Retention(RUNTIME) public @interface JsonApiId
Marks a field or method as the source of the JSON:API resource identifier.

This annotation can be applied to fields or getter methods to explicitly specify which property should be used as the id member of a JSON:API resource object. The annotated field or method return value will be serialized as the resource's id.

If this annotation is not present, the JSON:API for Spring HATEOASrary will fall back to:

  1. JPA @Id annotation (if present)
  2. A field named "id"

Example usage:


 public class Movie {
   @JsonApiId
   private String movieIdentifier;
   // or on getter:
   @JsonApiId
   public String getMovieIdentifier() {
     return movieIdentifier;
   }
 }
 
See Also: