Skip to content

Commit bc52469

Browse files
committed
Fix ResourceHttpRequestHandler empty location log
Fix ResourceHttpRequestHandler to only log warning when locations is empty. Issue: SPR-10780
1 parent 1678eaa commit bc52469

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandler.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,6 +34,7 @@
3434
import org.springframework.http.MediaType;
3535
import org.springframework.util.Assert;
3636
import org.springframework.util.ClassUtils;
37+
import org.springframework.util.CollectionUtils;
3738
import org.springframework.util.FileCopyUtils;
3839
import org.springframework.util.StringUtils;
3940
import org.springframework.web.HttpRequestHandler;
@@ -95,7 +96,7 @@ public void setLocations(List<Resource> locations) {
9596

9697
@Override
9798
public void afterPropertiesSet() throws Exception {
98-
if (logger.isWarnEnabled()) {
99+
if (logger.isWarnEnabled() && CollectionUtils.isEmpty(this.locations)) {
99100
logger.warn("Locations list is empty. No resources will be served");
100101
}
101102
}

0 commit comments

Comments
 (0)