代码:
@ResponseBody
@RequestMapping("/login.do")
public Json login(SysUserPM sysUserPM, HttpSession session) {
Json j = new Json();
SysUserPM sysUser = sysUserServiceI.doLogin(sysUserPM);
if (sysUser != null) {
System.out.println("后台用户登录成功!" + sysUser.getLoginname());
j.setSuccess(true);
j.setMsg("登陆成功!");SessionSysUser sessionSysUser = new SessionSysUser();
sessionSysUser.setId(sysUser.getId());
sessionSysUser.setLoginname(sysUser.getLoginname());
sessionSysUser.setName(sysUser.getName());
sessionSysUser.setResourceList(sysUserServiceI.resourceList(sysUser.getId()));
session.setAttribute(GlobalConstant.SESSION_SYS_USER, sessionSysUser);
} else {
j.setMsg("用户名或密码错误!");
}
return j;
}
SysUserPM sysUser = sysUserServiceI.doLogin(sysUserPM);
此处原先为:
SysUserPM sysUser = sysUserServiceI.login(sysUserPM);
结果与外层方法login重名导致aop拦截的时候在调用这个login之后就执行到AopAction中去了后面的if就没有执行了,解决办法:将名字改掉即可
spring AOP切面日志 拦截方法中有同名方法问题
时间: 2024-10-13 15:31:12