use of com.junliang.spring.aop.DataSource in project spring-boot by Linda-Tan.
the class UserService method login.
@DataSource(name = "readDataSource")
public String login(String username, String password) {
User user = userRepository.findByName(username);
if (user == null)
throw new BaseException(4001, "用户名不存在");
if (!user.getPassword().equals(password))
throw new BaseException(4002, "用户密码错误");
UserInfo userInfo = new UserInfo();
BeanCopierUtils.copyProperties(user, userInfo);
return generateToken(userInfo);
}
use of com.junliang.spring.aop.DataSource in project spring-boot by Linda-Tan.
the class UserService method test1.
@DataSource
public void test1() {
User user = new User();
user.setName("userRepository");
user.setPassword("userRepository");
userRepository.save(user);
}
Aggregations