|  | 
| 32 | 32 | import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoint; | 
| 33 | 33 | import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints; | 
| 34 | 34 | import org.springframework.boot.actuate.endpoint.web.WebServerNamespace; | 
|  | 35 | +import org.springframework.boot.web.context.WebServerApplicationContext; | 
|  | 36 | +import org.springframework.boot.web.server.WebServer; | 
| 35 | 37 | import org.springframework.context.support.StaticApplicationContext; | 
| 36 | 38 | import org.springframework.http.server.reactive.ServerHttpRequest; | 
| 37 | 39 | import org.springframework.http.server.reactive.ServerHttpResponse; | 
| 38 | 40 | import org.springframework.mock.http.server.reactive.MockServerHttpRequest; | 
| 39 | 41 | import org.springframework.mock.http.server.reactive.MockServerHttpResponse; | 
| 40 | 42 | import org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher; | 
|  | 43 | +import org.springframework.web.context.support.StaticWebApplicationContext; | 
| 41 | 44 | import org.springframework.web.server.ServerWebExchange; | 
| 42 | 45 | import org.springframework.web.server.WebHandler; | 
| 43 | 46 | import org.springframework.web.server.adapter.HttpWebHandlerAdapter; | 
| @@ -315,10 +318,8 @@ private RequestMatcherAssert assertMatcher(ServerWebExchangeMatcher matcher, | 
| 315 | 318 | 			PathMappedEndpoints pathMappedEndpoints, WebServerNamespace namespace) { | 
| 316 | 319 | 		StaticApplicationContext context = new StaticApplicationContext(); | 
| 317 | 320 | 		if (namespace != null && !WebServerNamespace.SERVER.equals(namespace)) { | 
| 318 |  | -			StaticApplicationContext parentContext = new StaticApplicationContext(); | 
| 319 |  | -			parentContext.setId("app"); | 
|  | 321 | +			NamedStaticWebApplicationContext parentContext = new NamedStaticWebApplicationContext(namespace); | 
| 320 | 322 | 			context.setParent(parentContext); | 
| 321 |  | -			context.setId(parentContext.getId() + ":" + namespace); | 
| 322 | 323 | 		} | 
| 323 | 324 | 		context.registerBean(WebEndpointProperties.class); | 
| 324 | 325 | 		if (pathMappedEndpoints != null) { | 
| @@ -351,6 +352,27 @@ private TestEndpoint mockEndpoint(EndpointId id, String rootPath, WebServerNames | 
| 351 | 352 | 		return endpoint; | 
| 352 | 353 | 	} | 
| 353 | 354 | 
 | 
|  | 355 | +	static class NamedStaticWebApplicationContext extends StaticWebApplicationContext | 
|  | 356 | +			implements WebServerApplicationContext { | 
|  | 357 | + | 
|  | 358 | +		private final WebServerNamespace webServerNamespace; | 
|  | 359 | + | 
|  | 360 | +		NamedStaticWebApplicationContext(WebServerNamespace webServerNamespace) { | 
|  | 361 | +			this.webServerNamespace = webServerNamespace; | 
|  | 362 | +		} | 
|  | 363 | + | 
|  | 364 | +		@Override | 
|  | 365 | +		public WebServer getWebServer() { | 
|  | 366 | +			return null; | 
|  | 367 | +		} | 
|  | 368 | + | 
|  | 369 | +		@Override | 
|  | 370 | +		public String getServerNamespace() { | 
|  | 371 | +			return (this.webServerNamespace != null) ? this.webServerNamespace.getValue() : null; | 
|  | 372 | +		} | 
|  | 373 | + | 
|  | 374 | +	} | 
|  | 375 | + | 
| 354 | 376 | 	static class RequestMatcherAssert implements AssertDelegateTarget { | 
| 355 | 377 | 
 | 
| 356 | 378 | 		private final StaticApplicationContext context; | 
|  | 
0 commit comments