【发布时间】:2018-09-23 15:52:55
【问题描述】:
在我的安全应用程序中,不会为 AuthenticationSuccessEvent 调用 Spring security ApplicationListener
@Component
public class LoginListener implements ApplicationListener<InteractiveAuthenticationSuccessEvent> {
@Override
public void onApplicationEvent(InteractiveAuthenticationSuccessEvent event)
{
log.info("Login success");
}
}
我该怎么办?
【问题讨论】:
-
您是否在 XML 配置或代码中将此类配置为
authentication-success-handler? -
没有。据我所知,这门课只是一个听众。
authentication-success-handlerr 类是另一回事。是否应该是authentication-success-handler才能按预期工作? -
您仍然需要将其注册为 bean。所以这应该添加
explicitly或者应该在component-scan路径中。这是在component-scan路径中吗? -
是的,在
component-scan
标签: java spring-security spring-security-oauth2