diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcher.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcher.java index 9e4cca6949..6f58df0332 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcher.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcher.java @@ -88,7 +88,8 @@ public abstract class ApplicationContextServerWebExchangeMatcher @SuppressWarnings("unchecked") private Supplier createContext(ServerWebExchange exchange) { ApplicationContext context = exchange.getApplicationContext(); - Assert.state(context != null, "No ApplicationContext found."); + Assert.state(context != null, + "No ApplicationContext found on ServerWebExchange."); if (this.contextClass.isInstance(context)) { return () -> (C) context; } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcherTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcherTests.java index 7ed62f17d3..f436e86751 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcherTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcherTests.java @@ -91,7 +91,7 @@ public class ApplicationContextServerWebExchangeMatcherTests { MockServerWebExchange exchange = MockServerWebExchange .from(MockServerHttpRequest.get("/path").build()); this.thrown.expect(IllegalStateException.class); - this.thrown.expectMessage("No ApplicationContext found."); + this.thrown.expectMessage("No ApplicationContext found on ServerWebExchange."); new TestApplicationContextServerWebExchangeMatcher<>(ExistingBean.class) .callMatchesAndReturnProvidedContext(exchange); }