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 3c33d7d7915..4eefb43debd 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 @@ -75,10 +75,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 f576776e93c..73c01cb48aa 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 @@ -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();