Merge branch '1.3.x'
This commit is contained in:
commit
ad5674cbb0
|
|
@ -33,6 +33,7 @@ import org.springframework.core.io.ResourceLoader;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @author Brian Clozel
|
* @author Brian Clozel
|
||||||
* @author Dave Syer
|
* @author Dave Syer
|
||||||
|
* @author Venil Noronha
|
||||||
* @since 1.1.0
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "spring.resources", ignoreUnknownFields = false)
|
@ConfigurationProperties(prefix = "spring.resources", ignoreUnknownFields = false)
|
||||||
|
|
@ -117,10 +118,9 @@ public class ResourceProperties implements ResourceLoaderAware {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Resource> getFaviconLocations() {
|
List<Resource> getFaviconLocations() {
|
||||||
List<Resource> locations = new ArrayList<Resource>(
|
List<Resource> locations = new ArrayList<Resource>(this.staticLocations.length + 1);
|
||||||
CLASSPATH_RESOURCE_LOCATIONS.length + 1);
|
|
||||||
if (this.resourceLoader != null) {
|
if (this.resourceLoader != null) {
|
||||||
for (String location : CLASSPATH_RESOURCE_LOCATIONS) {
|
for (String location : this.staticLocations) {
|
||||||
locations.add(this.resourceLoader.getResource(location));
|
locations.add(this.resourceLoader.getResource(location));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -398,7 +398,14 @@ public class WebMvcAutoConfigurationTests {
|
||||||
assertThat(this.context.getBeansOfType(SimpleUrlHandlerMapping.class)
|
assertThat(this.context.getBeansOfType(SimpleUrlHandlerMapping.class)
|
||||||
.get("faviconHandlerMapping")).isNotNull();
|
.get("faviconHandlerMapping")).isNotNull();
|
||||||
Map<String, List<Resource>> mappingLocations = getFaviconMappingLocations();
|
Map<String, List<Resource>> mappingLocations = getFaviconMappingLocations();
|
||||||
assertThat(mappingLocations.get("/**/favicon.ico")).hasSize(5);
|
assertThat(mappingLocations.get("/**/favicon.ico")).hasSize(6);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void faviconMappingUsesStaticLocations() throws IllegalAccessException {
|
||||||
|
load("spring.resources.static-locations=classpath:/static");
|
||||||
|
Map<String, List<Resource>> mappingLocations = getFaviconMappingLocations();
|
||||||
|
assertThat(mappingLocations.get("/**/favicon.ico")).hasSize(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue