You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using SpringSecurity
This is My UserDetail class. This class override getUsername() method from UserDetails class(from SpringSecurity).
Because this method would cause the userName field to be ignored, resulting in only 'username' in Json. However, my field requires camel hump, so I used @JsonIgnore
But strangely, I expected to get a userName field in Json, but I didn't get anything.
So I had to add @ JsonProperty to the userName field. Fortunately, he worked and obtained userName in the json.
like this:
But my other attributes are also annotated with @ Data to obtain Getter. But they don't need @ JsonProperty.
Why can other fields be processed normally, but userName cannot?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm using SpringSecurity


This is My UserDetail class. This class override getUsername() method from UserDetails class(from SpringSecurity).
Because this method would cause the userName field to be ignored, resulting in only 'username' in Json. However, my field requires camel hump, so I used @JsonIgnore
But strangely, I expected to get a userName field in Json, but I didn't get anything.
So I had to add @ JsonProperty to the userName field. Fortunately, he worked and obtained userName in the json.
like this:
But my other attributes are also annotated with @ Data to obtain Getter. But they don't need @ JsonProperty.
Why can other fields be processed normally, but userName cannot?
Beta Was this translation helpful? Give feedback.
All reactions