|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2024 the original author or authors. |
| 2 | + * Copyright 2012-2025 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -340,9 +340,12 @@ private RequestMatcherAssert assertMatcher(RequestMatcher matcher, PathMappedEnd
|
340 | 340 | }
|
341 | 341 |
|
342 | 342 | private RequestMatcherAssert assertMatcher(RequestMatcher matcher, PathMappedEndpoints pathMappedEndpoints,
|
343 |
| - RequestMatcherProvider matcherProvider, WebServerNamespace webServerNamespace) { |
344 |
| - StaticWebApplicationContext context = (webServerNamespace != null) |
345 |
| - ? new NamedStaticWebApplicationContext(webServerNamespace) : new StaticWebApplicationContext(); |
| 343 | + RequestMatcherProvider matcherProvider, WebServerNamespace namespace) { |
| 344 | + StaticWebApplicationContext context = new StaticWebApplicationContext(); |
| 345 | + if (namespace != null && !WebServerNamespace.SERVER.equals(namespace)) { |
| 346 | + NamedStaticWebApplicationContext parentContext = new NamedStaticWebApplicationContext(namespace); |
| 347 | + context.setParent(parentContext); |
| 348 | + } |
346 | 349 | context.registerBean(WebEndpointProperties.class);
|
347 | 350 | if (pathMappedEndpoints != null) {
|
348 | 351 | context.registerBean(PathMappedEndpoints.class, () -> pathMappedEndpoints);
|
@@ -373,7 +376,7 @@ public WebServer getWebServer() {
|
373 | 376 |
|
374 | 377 | @Override
|
375 | 378 | public String getServerNamespace() {
|
376 |
| - return this.webServerNamespace.getValue(); |
| 379 | + return (this.webServerNamespace != null) ? this.webServerNamespace.getValue() : null; |
377 | 380 | }
|
378 | 381 |
|
379 | 382 | }
|
|
0 commit comments