diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceHandlerUtils.java b/spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceHandlerUtils.java index 2e95c58fd5b..15d3cac542d 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceHandlerUtils.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceHandlerUtils.java @@ -76,10 +76,6 @@ public abstract class ResourceHandlerUtils { } else if (location instanceof ContextResource contextResource) { path = contextResource.getPathWithinContext(); - if ("/".equals(path)) { - logger.warn("Resource location '" + location + "' is considered unsafe " + - "and should not be used as it provides access to the root servlet context."); - } } else if (location instanceof UrlResource) { path = location.getURL().toExternalForm(); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHandlerUtils.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHandlerUtils.java index 5b1a133c8fa..884181b6b67 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHandlerUtils.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHandlerUtils.java @@ -77,10 +77,6 @@ public abstract class ResourceHandlerUtils { } else if (location instanceof ContextResource contextResource) { path = contextResource.getPathWithinContext(); - if ("/".equals(path)) { - logger.warn("Resource location '" + location + "' is considered unsafe " + - "and should not be used as it provides access to the root servlet context."); - } } else if (location instanceof UrlResource) { path = location.getURL().toExternalForm();