Browse Source

Improve null-safety of module/spring-boot-security

See gh-46926
pull/46973/head
Moritz Halbritter 7 months ago
parent
commit
dcd25abcce
  1. 14
      module/spring-boot-security/src/main/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcher.java

14
module/spring-boot-security/src/main/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcher.java

@ -80,16 +80,18 @@ public abstract class ApplicationContextServerWebExchangeMatcher<C> implements S @@ -80,16 +80,18 @@ public abstract class ApplicationContextServerWebExchangeMatcher<C> implements S
}
protected Supplier<C> getContext(ServerWebExchange exchange) {
if (this.context == null) {
Supplier<C> context = this.context;
if (context == null) {
synchronized (this.contextLock) {
if (this.context == null) {
Supplier<C> createdContext = createContext(exchange);
initialized(createdContext);
this.context = createdContext;
context = this.context;
if (context == null) {
context = createContext(exchange);
initialized(context);
this.context = context;
}
}
}
return this.context;
return context;
}
/**

Loading…
Cancel
Save