In Spring data rest how to allow user to set value but ignore it in get request -


in scenario 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 password not exposed in response when performing on ../users/1 allowing hal browser know when performing post request needs set password.

when i'm using @jsonignore hal browser not know needs set password field:

hal browser post request

how can it? possible?

have tried adding @jsonignore in getter method instead of private string password property?

...  @notnull @size(min = 60, max = 60) @column(name = "password",length = 60) private string password;  ...  @jsonignore public string getpassword(){     return this.password; }   public void setpassword(string password){     this.password = password; } 

edit: found this


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -