(1)SecurityUtils工具类获取
// 获取当前的用户名称
String username = SecurityUtils.getUsername();
(2)缓存获取当前用户信息
@Autowired
private TokenService tokenService;
LoginUser loginUser = tokenService.getLoginUser();
// 获取当前的用户名称
String username = loginUser.getUsername();
(3)vue中获取当前用户信息
const username = this.$store.state.user.name;
powered by kaifamiao