代码优化~

This commit is contained in:
冷冷 2018-04-24 20:44:35 +08:00
parent 2200e7c3ae
commit ef3b97d85b
1 changed files with 0 additions and 32 deletions

View File

@ -1,32 +0,0 @@
package com.github.pig.gateway.service.impl;
import com.github.pig.common.vo.UserVO;
import com.github.pig.gateway.feign.UserService;
import com.github.pig.gateway.util.UserDetailsImpl;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import java.io.Serializable;
/**
* @author lengleng
* @date 2017/10/26
* <p>
*/
@Service("userDetailService")
public class UserDetailServiceImpl implements UserDetailsService, Serializable {
@Autowired
private UserService userService;
@Override
public UserDetailsImpl loadUserByUsername(String username) throws UsernameNotFoundException {
if (StringUtils.isBlank(username)) {
throw new UsernameNotFoundException("用户不存在:" + username);
}
UserVO userVo = userService.findUserByUsername(username);
return new UserDetailsImpl(userVo);
}
}