Closes gh-11090
This commit is contained in:
Brian Clozel 2017-11-29 12:00:00 +01:00
parent de208cd372
commit 8b98db401c
3 changed files with 8 additions and 8 deletions

View File

@ -283,7 +283,7 @@ public class ResourceProperties {
* Cache control HTTP headers, only allows valid directive combinations. Overrides
* the 'spring.resources.cache.period' property.
*/
private final CacheControl cacheControl = new CacheControl();
private final Cachecontrol cachecontrol = new Cachecontrol();
public Duration getPeriod() {
return this.period;
@ -293,14 +293,14 @@ public class ResourceProperties {
this.period = period;
}
public CacheControl getCacheControl() {
return this.cacheControl;
public Cachecontrol getCachecontrol() {
return this.cachecontrol;
}
/**
* Cache Control HTTP header configuration.
*/
public static class CacheControl {
public static class Cachecontrol {
/**
* Maximum time the response should be cached, in seconds if no duration

View File

@ -307,7 +307,7 @@ public class WebMvcAutoConfiguration {
return;
}
Duration cachePeriod = this.resourceProperties.getCache().getPeriod();
CacheControl cacheControl = this.resourceProperties.getCache().getCacheControl()
CacheControl cacheControl = this.resourceProperties.getCache().getCachecontrol()
.toHttpCacheControl();
if (!registry.hasMappingForPattern("/webjars/**")) {
customizeResourceHandlerRegistration(

View File

@ -73,14 +73,14 @@ public class ResourcePropertiesTests {
@Test
public void emptyCacheControl() {
org.springframework.http.CacheControl cacheControl = this.properties.getCache().getCacheControl()
org.springframework.http.CacheControl cacheControl = this.properties.getCache().getCachecontrol()
.toHttpCacheControl();
assertThat(cacheControl.getHeaderValue()).isNull();
}
@Test
public void cacheControlAllPropertiesSet() {
Cache.CacheControl properties = this.properties.getCache().getCacheControl();
Cache.Cachecontrol properties = this.properties.getCache().getCachecontrol();
properties.setMaxAge(Duration.ofSeconds(4));
properties.setCachePrivate(true);
properties.setCachePublic(true);
@ -98,7 +98,7 @@ public class ResourcePropertiesTests {
@Test
public void invalidCacheControlCombination() {
Cache.CacheControl properties = this.properties.getCache().getCacheControl();
Cache.Cachecontrol properties = this.properties.getCache().getCachecontrol();
properties.setMaxAge(Duration.ofSeconds(4));
properties.setNoStore(true);
org.springframework.http.CacheControl cacheControl = properties.toHttpCacheControl();