@Component
public class LoginAttemptsLogger {
@Autowired
private AuthorisationLogService authorisationLogService;
@EventListener
public void auditEventHappened(AuditApplicationEvent auditApplicationEvent) {
AuditEvent auditEvent = auditApplicationEvent.getAuditEvent();
String principal = auditEvent.getPrincipal();
if (!principal.equals("anonymousUser")) {
if (auditEvent.getType().equals("AUTHENTICATION_SUCCESS")) {
authorisationLogService.logSuccessfulLogin(principal);
} else {
authorisationLogService.logUnSuccessfulLogin(principal);
}
}
}
}
Problem Occured in @EventListener. It was Working on Spring Boot 2.0.0.RELEASE.
When I update My project to Spring Boot 2.6.1 , Request doesn't automatically go into this method anymore, as it was before.
How Can I fix it ?