From 3570f7730ab242667731a68061e4434d050c5b70 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 9 Sep 2016 13:19:58 -0700 Subject: [PATCH] Prevent erroneous "empty locations" log warnings Update our `ResourceHttpRequestHandler` subclass so that the following warning is no longer displayed: "Locations list is empty. No resources will be served unless a custom ResourceResolver is configured as an alternative to PathResourceResolver." Fixes gh-6791 --- .../boot/actuate/endpoint/mvc/LogFileMvcEndpoint.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/LogFileMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/LogFileMvcEndpoint.java index f41b6bebbfd..b25a55f5521 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/LogFileMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/LogFileMvcEndpoint.java @@ -106,6 +106,7 @@ public class LogFileMvcEndpoint extends AbstractMvcEndpoint { Handler(Resource resource) { this.resource = resource; + getLocations().add(resource); try { afterPropertiesSet(); } @@ -114,6 +115,11 @@ public class LogFileMvcEndpoint extends AbstractMvcEndpoint { } } + @Override + protected void initAllowedLocations() { + this.getLocations().clear(); + } + @Override protected Resource getResource(HttpServletRequest request) throws IOException { return this.resource;