UserInfoService { @Transactional(readOnly = false) public void addUserInfo(UserInfo userInfo) throws Exception { userInfoMapperDao.insert(userInfo); String salt = DesUtil.encrypt(userInfo.getLoginName()); userInfo.setPassword(MD5Util.md5Encode(MD5Util.md5Encode(userInfo.getPassword()) + salt)); redisDaoTemplate.execute(new RedisCallback<String>() { public String doInRedis(Jedis jedis) throws Exception { String key = redisKeyConfiguration.getUserInfoLoginName() + userInfo.getLoginName(); String userInfoJson = jedis.set(key, JSON.toJSONString(userInfo)); return null; } }); }  UserInfo getLoginUserInfo(UserInfo userInfo); UserInfo getUserInfo(UserInfo userInfo); @Transactional(readOnly = false) void addUserInfo(UserInfo userInfo); UserInfo getUserInfo(Integer id); List<UserInfo> findAll();  }
@Test public void addUserInfo() throws Exception { UserInfo userInfo = new UserInfo(); userInfo.setId(2l); userInfo.setLoginName(LOGINNAME); userInfo.setPassword(PASSWORD); userInfoService.addUserInfo(userInfo); }