Skip to content

Commit 477b199

Browse files
author
Dave Syer
committed
Add ApplicationEventPublisher explicitly to security publisher
For some reason the exception mappings are only created with the publisher is initialized in the constructor of DefaultAuthenticationEventPublisher. Changed SpringBootWebSecurityConfiguration to do that rather then relying on the ApplicationEventPublisherAware behaviour to inject it. Fixes spring-projectsgh-719
1 parent 6ac85c1 commit 477b199

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
3030
import org.springframework.boot.autoconfigure.security.SecurityProperties.Headers;
3131
import org.springframework.boot.context.properties.EnableConfigurationProperties;
32+
import org.springframework.context.ApplicationEventPublisher;
3233
import org.springframework.context.annotation.Bean;
3334
import org.springframework.context.annotation.Configuration;
3435
import org.springframework.core.Ordered;
@@ -90,8 +91,9 @@ public class SpringBootWebSecurityConfiguration {
9091

9192
@Bean
9293
@ConditionalOnMissingBean
93-
public AuthenticationEventPublisher authenticationEventPublisher() {
94-
return new DefaultAuthenticationEventPublisher();
94+
public AuthenticationEventPublisher authenticationEventPublisher(
95+
ApplicationEventPublisher publisher) {
96+
return new DefaultAuthenticationEventPublisher(publisher);
9597
}
9698

9799
@Bean

0 commit comments

Comments
 (0)