|  | 
| 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.HttpMethod; | 
| 37 | 39 | import org.springframework.http.server.reactive.ServerHttpRequest; | 
| 38 | 40 | import org.springframework.http.server.reactive.ServerHttpResponse; | 
| 39 | 41 | import org.springframework.mock.http.server.reactive.MockServerHttpRequest; | 
| 40 | 42 | import org.springframework.mock.http.server.reactive.MockServerHttpResponse; | 
| 41 | 43 | import org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher; | 
|  | 44 | +import org.springframework.web.context.support.StaticWebApplicationContext; | 
| 42 | 45 | import org.springframework.web.server.ServerWebExchange; | 
| 43 | 46 | import org.springframework.web.server.WebHandler; | 
| 44 | 47 | import org.springframework.web.server.adapter.HttpWebHandlerAdapter; | 
| @@ -324,10 +327,8 @@ private RequestMatcherAssert assertMatcher(ServerWebExchangeMatcher matcher, | 
| 324 | 327 | 			PathMappedEndpoints pathMappedEndpoints, WebServerNamespace namespace) { | 
| 325 | 328 | 		StaticApplicationContext context = new StaticApplicationContext(); | 
| 326 | 329 | 		if (namespace != null && !WebServerNamespace.SERVER.equals(namespace)) { | 
| 327 |  | -			StaticApplicationContext parentContext = new StaticApplicationContext(); | 
| 328 |  | -			parentContext.setId("app"); | 
|  | 330 | +			NamedStaticWebApplicationContext parentContext = new NamedStaticWebApplicationContext(namespace); | 
| 329 | 331 | 			context.setParent(parentContext); | 
| 330 |  | -			context.setId(parentContext.getId() + ":" + namespace); | 
| 331 | 332 | 		} | 
| 332 | 333 | 		context.registerBean(WebEndpointProperties.class); | 
| 333 | 334 | 		if (pathMappedEndpoints != null) { | 
| @@ -360,6 +361,27 @@ private TestEndpoint mockEndpoint(EndpointId id, String rootPath, WebServerNames | 
| 360 | 361 | 		return endpoint; | 
| 361 | 362 | 	} | 
| 362 | 363 | 
 | 
|  | 364 | +	static class NamedStaticWebApplicationContext extends StaticWebApplicationContext | 
|  | 365 | +			implements WebServerApplicationContext { | 
|  | 366 | + | 
|  | 367 | +		private final WebServerNamespace webServerNamespace; | 
|  | 368 | + | 
|  | 369 | +		NamedStaticWebApplicationContext(WebServerNamespace webServerNamespace) { | 
|  | 370 | +			this.webServerNamespace = webServerNamespace; | 
|  | 371 | +		} | 
|  | 372 | + | 
|  | 373 | +		@Override | 
|  | 374 | +		public WebServer getWebServer() { | 
|  | 375 | +			return null; | 
|  | 376 | +		} | 
|  | 377 | + | 
|  | 378 | +		@Override | 
|  | 379 | +		public String getServerNamespace() { | 
|  | 380 | +			return (this.webServerNamespace != null) ? this.webServerNamespace.getValue() : null; | 
|  | 381 | +		} | 
|  | 382 | + | 
|  | 383 | +	} | 
|  | 384 | + | 
| 363 | 385 | 	static class RequestMatcherAssert implements AssertDelegateTarget { | 
| 364 | 386 | 
 | 
| 365 | 387 | 		private final StaticApplicationContext context; | 
|  | 
0 commit comments