Ejemplo n.º 1
0
  @Override
  public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {

    // http://stackoverflow.com/questions/16455348/autowired-dependency-injection-with-spring-security
    if (userRepository == null) {
      ApplicationContext context = ApplicationContextProvider.getApplicationContext();
      userRepository = context.getBean(UserRepository.class);
    }

    User user = userRepository.findUser(username);
    if (user != null) return new V2VUserDetails(user);
    else return null;
  }
Ejemplo n.º 2
0
 @Override
 public User getUserById(Long id) {
   return userRepository.findOne(id);
 }