Commit ac8e87d7 authored by Stephane Nicoll's avatar Stephane Nicoll

Polish contribution

Closes gh-5782
parent d5554e0a
...@@ -118,9 +118,9 @@ public class ResourceProperties implements ResourceLoaderAware { ...@@ -118,9 +118,9 @@ public class ResourceProperties implements ResourceLoaderAware {
} }
List<Resource> getFaviconLocations() { List<Resource> getFaviconLocations() {
List<Resource> locations = new ArrayList<Resource>(staticLocations.length + 1); List<Resource> locations = new ArrayList<Resource>(this.staticLocations.length + 1);
if (this.resourceLoader != null) { if (this.resourceLoader != null) {
for (String location : staticLocations) { for (String location : this.staticLocations) {
locations.add(this.resourceLoader.getResource(location)); locations.add(this.resourceLoader.getResource(location));
} }
} }
......
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -415,6 +415,13 @@ public class WebMvcAutoConfigurationTests { ...@@ -415,6 +415,13 @@ public class WebMvcAutoConfigurationTests {
assertThat(mappingLocations.get("/**/favicon.ico").size(), equalTo(6)); assertThat(mappingLocations.get("/**/favicon.ico").size(), equalTo(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").size(), equalTo(2));
}
@Test @Test
public void faviconMappingDisabled() throws IllegalAccessException { public void faviconMappingDisabled() throws IllegalAccessException {
load("spring.mvc.favicon.enabled:false"); load("spring.mvc.favicon.enabled:false");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment