Multiple users login in Spring application

Solution 1:

There can be a simple solution, try to reduce the scope of the user variable. Currently, you have a "user" variable in the controller, which is a singleton and is shared across all users, making it local and reducing its scope can solve your problem.