springboot security to get the current login user name

System.out.println(((User)SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getName());

 

${session.SPRING_SECURITY_CONTEXT.authentication.principal.name}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325141714&siteId=291194637