@Autowired
public SecurityContextServiceImpl(UserRepository userRepository) {
this.userRepository = userRepository;
}
@Override
<BUG>public User currentUser() {
</BUG>
final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
<BUG>final Optional<User> currentUser = userRepository.findOneByUsername(authentication.getName());

return currentUser.orElse(null);</BUG>
}

@Autowired
public SecurityContextServiceImpl(UserRepository userRepository) {
this.userRepository = userRepository;
