Skip to content

Commit ac8e87d

Browse files
committed
Polish contribution
Closes gh-5782
1 parent d5554e0 commit ac8e87d

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ResourceProperties.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ private String[] getStaticWelcomePageLocations() {
118118
}
119119

120120
List<Resource> getFaviconLocations() {
121-
List<Resource> locations = new ArrayList<Resource>(staticLocations.length + 1);
121+
List<Resource> locations = new ArrayList<Resource>(this.staticLocations.length + 1);
122122
if (this.resourceLoader != null) {
123-
for (String location : staticLocations) {
123+
for (String location : this.staticLocations) {
124124
locations.add(this.resourceLoader.getResource(location));
125125
}
126126
}

spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2015 the original author or authors.
2+
* Copyright 2012-2016 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.
@@ -415,6 +415,13 @@ public void faviconMapping() throws IllegalAccessException {
415415
assertThat(mappingLocations.get("/**/favicon.ico").size(), equalTo(6));
416416
}
417417

418+
@Test
419+
public void faviconMappingUsesStaticLocations() throws IllegalAccessException {
420+
load("spring.resources.static-locations=classpath:/static");
421+
Map<String, List<Resource>> mappingLocations = getFaviconMappingLocations();
422+
assertThat(mappingLocations.get("/**/favicon.ico").size(), equalTo(2));
423+
}
424+
418425
@Test
419426
public void faviconMappingDisabled() throws IllegalAccessException {
420427
load("spring.mvc.favicon.enabled:false");

0 commit comments

Comments
 (0)