String username=SecurityContextHolder.getContext().getAuthentication().getName(); AuthUser user=userRepository.findFirstByUserName(username);
SecurityContextHolder ==>从threadllocal中获取用户
threadllocaly ==>用于保存某个线程共享变量
String username=SecurityContextHolder.getContext().getAuthentication().getName(); AuthUser user=userRepository.findFirstByUserName(username);
SecurityContextHolder ==>从threadllocal中获取用户
threadllocaly ==>用于保存某个线程共享变量