コード例 #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;
  }
コード例 #2
0
ファイル: UserServiceImpl.java プロジェクト: kgalieva/masters
 @Override
 public User getUserById(Long id) {
   return userRepository.findOne(id);
 }