Open rainerhahnekamp opened 6 years ago
Instead of using static methods of SecurityUtils and UserRepository to get the current logged in user, create a Spring Bean service, that can be injected into a controller and returns the user if logged in.
SecurityUtils
UserRepository
The signature should be like this.
public Optional<User> getCurrentUser();
Instead of using static methods of
SecurityUtils
andUserRepository
to get the current logged in user, create a Spring Bean service, that can be injected into a controller and returns the user if logged in.The signature should be like this.