Skip to content

Commit 3570f77

Browse files
committed
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
1 parent ca2b97b commit 3570f77

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/LogFileMvcEndpoint.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ private static class Handler extends ResourceHttpRequestHandler {
106106

107107
Handler(Resource resource) {
108108
this.resource = resource;
109+
getLocations().add(resource);
109110
try {
110111
afterPropertiesSet();
111112
}
@@ -114,6 +115,11 @@ private static class Handler extends ResourceHttpRequestHandler {
114115
}
115116
}
116117

118+
@Override
119+
protected void initAllowedLocations() {
120+
this.getLocations().clear();
121+
}
122+
117123
@Override
118124
protected Resource getResource(HttpServletRequest request) throws IOException {
119125
return this.resource;

0 commit comments

Comments
 (0)