安全性的授权检查部分从中获取已认证的对象
SecurityContext,当请求通过spring安全性过滤器时将进行设置。我在这里的假设是,登录后不久就没有设置它。你可能可以使用下面提供的hack来设置值。
try { SecurityContext ctx = SecurityContextHolder.createEmptyContext(); SecurityContextHolder.setContext(ctx); ctx.setAuthentication(event.getAuthentication()); //Do what ever you want to do} finally { SecurityContextHolder.clearContext();}


