In scenario where I'm exposing following entity in Spring data rest:
public class User implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "user_id")
private Long userId;
@NotNull
@Size(min = 1, max = 50)
@Column(length = 50, unique = true, nullable = false)
private String username;
@JsonIgnore
@NotNull
@Size(min = 60, max = 60)
@Column(name = "password",length = 60)
private String password;
....
I would like password to not be exposed in the response when performing GET on ../users/1 but allowing hal browser to know that when performing post request it needs to set password.
When I'm using @JsonIgnore Hal Browser do not know that it needs to set password field:
How can I do it? Is this even possible?