@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; }
@Override public User getUserById(Long id) { return userRepository.findOne(id); }