mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-05-31 01:02:14 +00:00
Refactor equals method
To use the accessor method for username instead of directly accessing the attribute.
This commit is contained in:
parent
ea19f82b8a
commit
de1357cbd1
@ -179,8 +179,8 @@ public class User implements UserDetails, CredentialsContainer {
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof User) {
|
||||
return this.username.equals(((User) obj).username);
|
||||
if (obj instanceof User user) {
|
||||
return this.username.equals(user.getUsername());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user