diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ResourceProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ResourceProperties.java index e2bae6c3590..db0e349ec29 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ResourceProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ResourceProperties.java @@ -118,9 +118,9 @@ public class ResourceProperties implements ResourceLoaderAware { } List getFaviconLocations() { - List locations = new ArrayList(staticLocations.length + 1); + List locations = new ArrayList(this.staticLocations.length + 1); if (this.resourceLoader != null) { - for (String location : staticLocations) { + for (String location : this.staticLocations) { locations.add(this.resourceLoader.getResource(location)); } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java index 7de728941e3..acd2d82d055 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * 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"); * you may not use this file except in compliance with the License. @@ -415,6 +415,13 @@ public class WebMvcAutoConfigurationTests { assertThat(mappingLocations.get("/**/favicon.ico").size(), equalTo(6)); } + @Test + public void faviconMappingUsesStaticLocations() throws IllegalAccessException { + load("spring.resources.static-locations=classpath:/static"); + Map> mappingLocations = getFaviconMappingLocations(); + assertThat(mappingLocations.get("/**/favicon.ico").size(), equalTo(2)); + } + @Test public void faviconMappingDisabled() throws IllegalAccessException { load("spring.mvc.favicon.enabled:false");