baseUserService 服务增加异常捕获

This commit is contained in:
ajaxfan
2021-05-11 14:43:31 +08:00
parent d11cfe51fc
commit 8c83be901d

View File

@ -31,13 +31,11 @@ public class BaseCacheUserServiceImpl implements IBaseCacheUserService {
@Override @Override
public BaseCacheUser getCacheUser() { public BaseCacheUser getCacheUser() {
BaseCacheUser buser = new BaseCacheUser(); BaseCacheUser buser = new BaseCacheUser();
try {
System.out.println(SecurityContextHolder.getContext()); BeanUtils.copyProperties(SecurityContextHolder.getContext().getAuthentication().getPrincipal(), buser);
System.out.println(SecurityContextHolder.getContext().getAuthentication()); } catch (Exception e) {
System.out.println(SecurityContextHolder.getContext().getAuthentication().getPrincipal()); log.error(e.getMessage());
}
BeanUtils.copyProperties(SecurityContextHolder.getContext().getAuthentication().getPrincipal(), buser);
log.debug("Current user principal: " + buser); log.debug("Current user principal: " + buser);
return buser; return buser;