java - spring security 无法获取已经登陆的用户ID?
PHP中文网
PHP中文网 2017-04-18 09:05:25
0
2
608
    Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();

直接抛异常 显示为null;

PHP中文网
PHP中文网

认证0级讲师

reply all(2)
Peter_Zhu

Thanks for the invitation! It must be intercept-url. This URL can obtain the logged-in user.

<intercept-url pattern="/你的URL或者包含你的URL的配置" access="..." />
伊谢尔伦

If you put this together, who can tell which method returned null?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template