mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-29 15:22:15 +00:00
Polish
Use `getBeanOrNull` in `registerDelegateApplicationListener` to simplify implementation. This change does not alter behavior.
This commit is contained in:
parent
dbdeec4216
commit
f1db7167cb
@ -692,15 +692,10 @@ public final class SessionManagementConfigurer<H extends HttpSecurityBuilder<H>>
|
|||||||
|
|
||||||
private void registerDelegateApplicationListener(H http,
|
private void registerDelegateApplicationListener(H http,
|
||||||
ApplicationListener<?> delegate) {
|
ApplicationListener<?> delegate) {
|
||||||
ApplicationContext context = http.getSharedObject(ApplicationContext.class);
|
DelegatingApplicationListener delegating = getBeanOrNull(DelegatingApplicationListener.class);
|
||||||
if (context == null) {
|
if (delegating == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (context.getBeansOfType(DelegatingApplicationListener.class).isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DelegatingApplicationListener delegating = context
|
|
||||||
.getBean(DelegatingApplicationListener.class);
|
|
||||||
SmartApplicationListener smartListener = new GenericApplicationListenerAdapter(
|
SmartApplicationListener smartListener = new GenericApplicationListenerAdapter(
|
||||||
delegate);
|
delegate);
|
||||||
delegating.addListener(smartListener);
|
delegating.addListener(smartListener);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user