Rename properties that have `-` in their prefix

Rename `reactive-repositories` to `reactiverepositories` and replace
`spring.resources.cache-control` with `spring.resources.cache.control`.

Fixes gh-11090
pull/11128/head
Phillip Webb 7 years ago
parent 47bc5e71ab
commit d99625fa78

@ -39,7 +39,7 @@ import org.springframework.data.cassandra.repository.support.ReactiveCassandraRe
*/ */
@Configuration @Configuration
@ConditionalOnClass({ ReactiveSession.class, ReactiveCassandraRepository.class }) @ConditionalOnClass({ ReactiveSession.class, ReactiveCassandraRepository.class })
@ConditionalOnProperty(prefix = "spring.data.cassandra.reactive-repositories", name = "enabled", havingValue = "true", matchIfMissing = true) @ConditionalOnProperty(prefix = "spring.data.cassandra.reactiverepositories", name = "enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnMissingBean(ReactiveCassandraRepositoryFactoryBean.class) @ConditionalOnMissingBean(ReactiveCassandraRepositoryFactoryBean.class)
@Import(CassandraReactiveRepositoriesAutoConfigureRegistrar.class) @Import(CassandraReactiveRepositoriesAutoConfigureRegistrar.class)
@AutoConfigureAfter(CassandraReactiveDataAutoConfiguration.class) @AutoConfigureAfter(CassandraReactiveDataAutoConfiguration.class)

@ -39,7 +39,7 @@ import org.springframework.data.couchbase.repository.support.ReactiveCouchbaseRe
*/ */
@Configuration @Configuration
@ConditionalOnClass({ Bucket.class, ReactiveCouchbaseRepository.class }) @ConditionalOnClass({ Bucket.class, ReactiveCouchbaseRepository.class })
@ConditionalOnProperty(prefix = "spring.data.couchbase.reactive-repositories", name = "enabled", havingValue = "true", matchIfMissing = true) @ConditionalOnProperty(prefix = "spring.data.couchbase.reactiverepositories", name = "enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnBean(ReactiveRepositoryOperationsMapping.class) @ConditionalOnBean(ReactiveRepositoryOperationsMapping.class)
@ConditionalOnMissingBean(ReactiveCouchbaseRepositoryFactoryBean.class) @ConditionalOnMissingBean(ReactiveCouchbaseRepositoryFactoryBean.class)
@Import(CouchbaseReactiveRepositoriesAutoConfigureRegistrar.class) @Import(CouchbaseReactiveRepositoriesAutoConfigureRegistrar.class)

@ -51,7 +51,7 @@ import org.springframework.data.mongodb.repository.support.ReactiveMongoReposito
@ConditionalOnClass({ MongoClient.class, ReactiveMongoRepository.class }) @ConditionalOnClass({ MongoClient.class, ReactiveMongoRepository.class })
@ConditionalOnMissingBean({ ReactiveMongoRepositoryFactoryBean.class, @ConditionalOnMissingBean({ ReactiveMongoRepositoryFactoryBean.class,
ReactiveMongoRepositoryConfigurationExtension.class }) ReactiveMongoRepositoryConfigurationExtension.class })
@ConditionalOnProperty(prefix = "spring.data.mongodb.reactive-repositories", name = "enabled", havingValue = "true", matchIfMissing = true) @ConditionalOnProperty(prefix = "spring.data.mongodb.reactiverepositories", name = "enabled", havingValue = "true", matchIfMissing = true)
@Import(MongoReactiveRepositoriesAutoConfigureRegistrar.class) @Import(MongoReactiveRepositoriesAutoConfigureRegistrar.class)
@AutoConfigureAfter(MongoReactiveDataAutoConfiguration.class) @AutoConfigureAfter(MongoReactiveDataAutoConfiguration.class)
public class MongoReactiveRepositoriesAutoConfiguration { public class MongoReactiveRepositoriesAutoConfiguration {

@ -48,20 +48,6 @@ public class ResourceProperties {
*/ */
private String[] staticLocations = CLASSPATH_RESOURCE_LOCATIONS; private String[] staticLocations = CLASSPATH_RESOURCE_LOCATIONS;
/**
* Cache period for the resources served by the resource handler. If a duration suffix
* is not specified, seconds will be used. Can be overridden by the 'cache-control'
* property.
*/
@DefaultDurationUnit(ChronoUnit.SECONDS)
private Duration cachePeriod;
/**
* Cache control HTTP headers, only allows valid directive combinations. Overrides the
* 'cache-period' property.
*/
private CacheControlProperties cacheControl = new CacheControlProperties();
/** /**
* Whether to enable default resource handling. * Whether to enable default resource handling.
*/ */
@ -69,6 +55,8 @@ public class ResourceProperties {
private final Chain chain = new Chain(); private final Chain chain = new Chain();
private final Cache cache = new Cache();
public String[] getStaticLocations() { public String[] getStaticLocations() {
return this.staticLocations; return this.staticLocations;
} }
@ -86,22 +74,6 @@ public class ResourceProperties {
return normalized; return normalized;
} }
public Duration getCachePeriod() {
return this.cachePeriod;
}
public void setCachePeriod(Duration cachePeriod) {
this.cachePeriod = cachePeriod;
}
public CacheControlProperties getCacheControl() {
return this.cacheControl;
}
public void setCacheControl(CacheControlProperties cacheControl) {
this.cacheControl = cacheControl;
}
public boolean isAddMappings() { public boolean isAddMappings() {
return this.addMappings; return this.addMappings;
} }
@ -114,6 +86,10 @@ public class ResourceProperties {
return this.chain; return this.chain;
} }
public Cache getCache() {
return this.cache;
}
/** /**
* Configuration for the Spring Resource Handling chain. * Configuration for the Spring Resource Handling chain.
*/ */
@ -292,204 +268,240 @@ public class ResourceProperties {
} }
/** /**
* Configuration for the Cache Control HTTP header. * Cache configuration.
*/ */
public static class CacheControlProperties { public static class Cache {
/** /**
* Maximum time the response should be cached, in seconds if no duration suffix is * Cache period for the resources served by the resource handler. If a duration
* not specified. * suffix is not specified, seconds will be used. Can be overridden by the
* 'spring.resources.cache.control' properties.
*/ */
@DefaultDurationUnit(ChronoUnit.SECONDS) @DefaultDurationUnit(ChronoUnit.SECONDS)
private Duration maxAge; private Duration period;
/**
* Indicate that the cached response can be reused only if re-validated with the
* server.
*/
private Boolean noCache;
/**
* Indicate to not cache the response in any case.
*/
private Boolean noStore;
/** /**
* Indicate that once it has become stale, a cache must not use the response * Cache control HTTP headers, only allows valid directive combinations. Overrides
* without re-validating it with the server. * the 'spring.resources.cache.period' property.
*/ */
private Boolean mustRevalidate; private final Control control = new Control();
/**
* Indicate intermediaries (caches and others) that they should not transform the
* response content.
*/
private Boolean noTransform;
/**
* Indicate that any cache may store the response.
*/
private Boolean cachePublic;
/**
* Indicate that the response message is intended for a single user and must not
* be stored by a shared cache.
*/
private Boolean cachePrivate;
/**
* Same meaning as the "must-revalidate" directive, except that it does not apply
* to private caches.
*/
private Boolean proxyRevalidate;
/**
* Maximum time the response can be served after it becomes stale, in seconds if
* no duration suffix is not specified.
*/
@DefaultDurationUnit(ChronoUnit.SECONDS)
private Duration staleWhileRevalidate;
/**
* Maximum time the response may be used when errors are encountered, in seconds
* if no duration suffix is not specified.
*/
@DefaultDurationUnit(ChronoUnit.SECONDS)
private Duration staleIfError;
/**
* Maximum time the response should be cached by shared caches, in seconds if no
* duration suffix is not specified.
*/
@DefaultDurationUnit(ChronoUnit.SECONDS)
private Duration sMaxAge;
public Duration getMaxAge() { public Duration getPeriod() {
return this.maxAge; return this.period;
} }
public void setMaxAge(Duration maxAge) { public void setPeriod(Duration period) {
this.maxAge = maxAge; this.period = period;
} }
public Boolean getNoCache() { public Control getControl() {
return this.noCache; return this.control;
} }
public void setNoCache(Boolean noCache) { /**
this.noCache = noCache; * Cache Control HTTP header configuration.
} */
public static class Control {
public Boolean getNoStore() {
return this.noStore; /**
} * Maximum time the response should be cached, in seconds if no duration
* suffix is not specified.
*/
@DefaultDurationUnit(ChronoUnit.SECONDS)
private Duration maxAge;
/**
* Indicate that the cached response can be reused only if re-validated with
* the server.
*/
private Boolean noCache;
/**
* Indicate to not cache the response in any case.
*/
private Boolean noStore;
/**
* Indicate that once it has become stale, a cache must not use the response
* without re-validating it with the server.
*/
private Boolean mustRevalidate;
/**
* Indicate intermediaries (caches and others) that they should not transform
* the response content.
*/
private Boolean noTransform;
/**
* Indicate that any cache may store the response.
*/
private Boolean cachePublic;
/**
* Indicate that the response message is intended for a single user and must
* not be stored by a shared cache.
*/
private Boolean cachePrivate;
/**
* Same meaning as the "must-revalidate" directive, except that it does not
* apply to private caches.
*/
private Boolean proxyRevalidate;
/**
* Maximum time the response can be served after it becomes stale, in seconds
* if no duration suffix is not specified.
*/
@DefaultDurationUnit(ChronoUnit.SECONDS)
private Duration staleWhileRevalidate;
/**
* Maximum time the response may be used when errors are encountered, in
* seconds if no duration suffix is not specified.
*/
@DefaultDurationUnit(ChronoUnit.SECONDS)
private Duration staleIfError;
/**
* Maximum time the response should be cached by shared caches, in seconds if
* no duration suffix is not specified.
*/
@DefaultDurationUnit(ChronoUnit.SECONDS)
private Duration sMaxAge;
public Duration getMaxAge() {
return this.maxAge;
}
public void setNoStore(Boolean noStore) { public void setMaxAge(Duration maxAge) {
this.noStore = noStore; this.maxAge = maxAge;
} }
public Boolean getMustRevalidate() { public Boolean getNoCache() {
return this.mustRevalidate; return this.noCache;
} }
public void setMustRevalidate(Boolean mustRevalidate) { public void setNoCache(Boolean noCache) {
this.mustRevalidate = mustRevalidate; this.noCache = noCache;
} }
public Boolean getNoTransform() { public Boolean getNoStore() {
return this.noTransform; return this.noStore;
} }
public void setNoTransform(Boolean noTransform) { public void setNoStore(Boolean noStore) {
this.noTransform = noTransform; this.noStore = noStore;
} }
public Boolean getCachePublic() { public Boolean getMustRevalidate() {
return this.cachePublic; return this.mustRevalidate;
} }
public void setCachePublic(Boolean cachePublic) { public void setMustRevalidate(Boolean mustRevalidate) {
this.cachePublic = cachePublic; this.mustRevalidate = mustRevalidate;
} }
public Boolean getCachePrivate() { public Boolean getNoTransform() {
return this.cachePrivate; return this.noTransform;
} }
public void setCachePrivate(Boolean cachePrivate) { public void setNoTransform(Boolean noTransform) {
this.cachePrivate = cachePrivate; this.noTransform = noTransform;
} }
public Boolean getProxyRevalidate() { public Boolean getCachePublic() {
return this.proxyRevalidate; return this.cachePublic;
} }
public void setProxyRevalidate(Boolean proxyRevalidate) { public void setCachePublic(Boolean cachePublic) {
this.proxyRevalidate = proxyRevalidate; this.cachePublic = cachePublic;
} }
public Duration getStaleWhileRevalidate() { public Boolean getCachePrivate() {
return this.staleWhileRevalidate; return this.cachePrivate;
} }
public void setStaleWhileRevalidate(Duration staleWhileRevalidate) { public void setCachePrivate(Boolean cachePrivate) {
this.staleWhileRevalidate = staleWhileRevalidate; this.cachePrivate = cachePrivate;
} }
public Duration getStaleIfError() { public Boolean getProxyRevalidate() {
return this.staleIfError; return this.proxyRevalidate;
} }
public void setStaleIfError(Duration staleIfError) { public void setProxyRevalidate(Boolean proxyRevalidate) {
this.staleIfError = staleIfError; this.proxyRevalidate = proxyRevalidate;
} }
public Duration getSMaxAge() { public Duration getStaleWhileRevalidate() {
return this.sMaxAge; return this.staleWhileRevalidate;
} }
public void setSMaxAge(Duration sMaxAge) { public void setStaleWhileRevalidate(Duration staleWhileRevalidate) {
this.sMaxAge = sMaxAge; this.staleWhileRevalidate = staleWhileRevalidate;
} }
public CacheControl toHttpCacheControl() { public Duration getStaleIfError() {
CacheControl cacheControl = createCacheControl(); return this.staleIfError;
callIfTrue(this.mustRevalidate, cacheControl, CacheControl::mustRevalidate);
callIfTrue(this.noTransform, cacheControl, CacheControl::noTransform);
callIfTrue(this.cachePublic, cacheControl, CacheControl::cachePublic);
callIfTrue(this.cachePrivate, cacheControl, CacheControl::cachePrivate);
callIfTrue(this.proxyRevalidate, cacheControl, CacheControl::proxyRevalidate);
if (this.staleWhileRevalidate != null) {
cacheControl.staleWhileRevalidate(this.staleWhileRevalidate.getSeconds(),
TimeUnit.SECONDS);
} }
if (this.staleIfError != null) {
cacheControl.staleIfError(this.staleIfError.getSeconds(), public void setStaleIfError(Duration staleIfError) {
TimeUnit.SECONDS); this.staleIfError = staleIfError;
} }
if (this.sMaxAge != null) {
cacheControl.sMaxAge(this.sMaxAge.getSeconds(), TimeUnit.SECONDS); public Duration getSMaxAge() {
return this.sMaxAge;
} }
return cacheControl;
}
private CacheControl createCacheControl() { public void setSMaxAge(Duration sMaxAge) {
if (Boolean.TRUE.equals(this.noStore)) { this.sMaxAge = sMaxAge;
return CacheControl.noStore();
} }
if (Boolean.TRUE.equals(this.noCache)) {
return CacheControl.noCache(); public CacheControl toHttpCacheControl() {
CacheControl cacheControl = createCacheControl();
callIfTrue(this.mustRevalidate, cacheControl,
CacheControl::mustRevalidate);
callIfTrue(this.noTransform, cacheControl, CacheControl::noTransform);
callIfTrue(this.cachePublic, cacheControl, CacheControl::cachePublic);
callIfTrue(this.cachePrivate, cacheControl, CacheControl::cachePrivate);
callIfTrue(this.proxyRevalidate, cacheControl,
CacheControl::proxyRevalidate);
if (this.staleWhileRevalidate != null) {
cacheControl.staleWhileRevalidate(
this.staleWhileRevalidate.getSeconds(), TimeUnit.SECONDS);
}
if (this.staleIfError != null) {
cacheControl.staleIfError(this.staleIfError.getSeconds(),
TimeUnit.SECONDS);
}
if (this.sMaxAge != null) {
cacheControl.sMaxAge(this.sMaxAge.getSeconds(), TimeUnit.SECONDS);
}
return cacheControl;
} }
if (this.maxAge != null) {
return CacheControl.maxAge(this.maxAge.getSeconds(), TimeUnit.SECONDS); private CacheControl createCacheControl() {
if (Boolean.TRUE.equals(this.noStore)) {
return CacheControl.noStore();
}
if (Boolean.TRUE.equals(this.noCache)) {
return CacheControl.noCache();
}
if (this.maxAge != null) {
return CacheControl.maxAge(this.maxAge.getSeconds(),
TimeUnit.SECONDS);
}
return CacheControl.empty();
} }
return CacheControl.empty();
}
private <T> void callIfTrue(Boolean property, T instance, Consumer<T> call) { private <T> void callIfTrue(Boolean property, T instance, Consumer<T> call) {
if (Boolean.TRUE.equals(property)) { if (Boolean.TRUE.equals(property)) {
call.accept(instance); call.accept(instance);
}
} }
} }
} }

@ -146,7 +146,7 @@ public class WebFluxAutoConfiguration {
logger.debug("Default resource handling disabled"); logger.debug("Default resource handling disabled");
return; return;
} }
Duration cachePeriod = this.resourceProperties.getCachePeriod(); Duration cachePeriod = this.resourceProperties.getCache().getPeriod();
if (!registry.hasMappingForPattern("/webjars/**")) { if (!registry.hasMappingForPattern("/webjars/**")) {
ResourceHandlerRegistration registration = registry ResourceHandlerRegistration registration = registry
.addResourceHandler("/webjars/**") .addResourceHandler("/webjars/**")

@ -306,8 +306,8 @@ public class WebMvcAutoConfiguration {
logger.debug("Default resource handling disabled"); logger.debug("Default resource handling disabled");
return; return;
} }
Duration cachePeriod = this.resourceProperties.getCachePeriod(); Duration cachePeriod = this.resourceProperties.getCache().getPeriod();
CacheControl cacheControl = this.resourceProperties.getCacheControl() CacheControl cacheControl = this.resourceProperties.getCache().getControl()
.toHttpCacheControl(); .toHttpCacheControl();
if (!registry.hasMappingForPattern("/webjars/**")) { if (!registry.hasMappingForPattern("/webjars/**")) {
customizeResourceHandlerRegistration( customizeResourceHandlerRegistration(

@ -94,7 +94,7 @@
"defaultValue": "none" "defaultValue": "none"
}, },
{ {
"name": "spring.data.cassandra.reactive-repositories.enabled", "name": "spring.data.cassandra.reactiverepositories.enabled",
"type": "java.lang.Boolean", "type": "java.lang.Boolean",
"description": "Whether to enable Cassandra reactive repositories.", "description": "Whether to enable Cassandra reactive repositories.",
"defaultValue": true "defaultValue": true
@ -110,7 +110,7 @@
"defaultValue": "read-your-own-writes" "defaultValue": "read-your-own-writes"
}, },
{ {
"name": "spring.data.couchbase.reactive-repositories.enabled", "name": "spring.data.couchbase.reactiverepositories.enabled",
"type": "java.lang.Boolean", "type": "java.lang.Boolean",
"description": "Whether to enable Couchbase reactive repositories.", "description": "Whether to enable Couchbase reactive repositories.",
"defaultValue": true "defaultValue": true
@ -140,7 +140,7 @@
"defaultValue": true "defaultValue": true
}, },
{ {
"name": "spring.data.mongodb.reactive-repositories.enabled", "name": "spring.data.mongodb.reactiverepositories.enabled",
"type": "java.lang.Boolean", "type": "java.lang.Boolean",
"description": "Whether to enable Mongo reactive repositories.", "description": "Whether to enable Mongo reactive repositories.",
"defaultValue": true "defaultValue": true
@ -1197,6 +1197,15 @@
"level": "error" "level": "error"
} }
}, },
{
"name": "spring.resources.cach-period",
"type": "java.lang.Integer",
"description": "Cache period for the resources served by the resource handler. If a duration suffix is not specified, seconds will be used.",
"deprecation": {
"replacement": "spring.resources.cach-period",
"level": "error"
}
},
{ {
"name": "spring.sendgrid.password", "name": "spring.sendgrid.password",
"type": "java.lang.String", "type": "java.lang.String",

@ -67,7 +67,7 @@ public class CouchbaseReactiveRepositoriesAutoConfigurationTests {
@Test @Test
public void disableReactiveRepository() { public void disableReactiveRepository() {
load(DefaultConfiguration.class, load(DefaultConfiguration.class,
"spring.data.couchbase.reactive-repositories.enabled=false", "spring.data.couchbase.reactiverepositories.enabled=false",
"spring.data.couchbase.repositories.enabled=false"); "spring.data.couchbase.repositories.enabled=false");
assertThat(this.context.getBeansOfType(ReactiveCityRepository.class)).hasSize(0); assertThat(this.context.getBeansOfType(ReactiveCityRepository.class)).hasSize(0);
} }

@ -22,7 +22,7 @@ import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException; import org.junit.rules.ExpectedException;
import org.springframework.boot.autoconfigure.web.ResourceProperties.CacheControlProperties; import org.springframework.boot.autoconfigure.web.ResourceProperties.Cache;
import org.springframework.boot.testsupport.assertj.Matched; import org.springframework.boot.testsupport.assertj.Matched;
import org.springframework.http.CacheControl; import org.springframework.http.CacheControl;
@ -79,28 +79,24 @@ public class ResourcePropertiesTests {
@Test @Test
public void emptyCacheControl() { public void emptyCacheControl() {
CacheControlProperties cacheControlProperties = new CacheControlProperties(); CacheControl cacheControl = this.properties.getCache().getControl()
this.properties.setCacheControl(cacheControlProperties);
CacheControl cacheControl = this.properties.getCacheControl()
.toHttpCacheControl(); .toHttpCacheControl();
assertThat(cacheControl.getHeaderValue()).isNull(); assertThat(cacheControl.getHeaderValue()).isNull();
} }
@Test @Test
public void cacheControlAllPropertiesSet() { public void cacheControlAllPropertiesSet() {
CacheControlProperties cacheControlProperties = new CacheControlProperties(); Cache.Control properties = this.properties.getCache().getControl();
cacheControlProperties.setMaxAge(Duration.ofSeconds(4)); properties.setMaxAge(Duration.ofSeconds(4));
cacheControlProperties.setCachePrivate(true); properties.setCachePrivate(true);
cacheControlProperties.setCachePublic(true); properties.setCachePublic(true);
cacheControlProperties.setMustRevalidate(true); properties.setMustRevalidate(true);
cacheControlProperties.setNoTransform(true); properties.setNoTransform(true);
cacheControlProperties.setProxyRevalidate(true); properties.setProxyRevalidate(true);
cacheControlProperties.setSMaxAge(Duration.ofSeconds(5)); properties.setSMaxAge(Duration.ofSeconds(5));
cacheControlProperties.setStaleIfError(Duration.ofSeconds(6)); properties.setStaleIfError(Duration.ofSeconds(6));
cacheControlProperties.setStaleWhileRevalidate(Duration.ofSeconds(7)); properties.setStaleWhileRevalidate(Duration.ofSeconds(7));
this.properties.setCacheControl(cacheControlProperties); CacheControl cacheControl = properties.toHttpCacheControl();
CacheControl cacheControl = this.properties.getCacheControl()
.toHttpCacheControl();
assertThat(cacheControl.getHeaderValue()).isEqualTo( assertThat(cacheControl.getHeaderValue()).isEqualTo(
"max-age=4, must-revalidate, no-transform, public, private, proxy-revalidate," "max-age=4, must-revalidate, no-transform, public, private, proxy-revalidate,"
+ " s-maxage=5, stale-if-error=6, stale-while-revalidate=7"); + " s-maxage=5, stale-if-error=6, stale-while-revalidate=7");
@ -108,12 +104,10 @@ public class ResourcePropertiesTests {
@Test @Test
public void invalidCacheControlCombination() { public void invalidCacheControlCombination() {
CacheControlProperties cacheControlProperties = new CacheControlProperties(); Cache.Control properties = this.properties.getCache().getControl();
cacheControlProperties.setMaxAge(Duration.ofSeconds(4)); properties.setMaxAge(Duration.ofSeconds(4));
cacheControlProperties.setNoStore(true); properties.setNoStore(true);
this.properties.setCacheControl(cacheControlProperties); CacheControl cacheControl = properties.toHttpCacheControl();
CacheControl cacheControl = this.properties.getCacheControl()
.toHttpCacheControl();
assertThat(cacheControl.getHeaderValue()).isEqualTo("no-store"); assertThat(cacheControl.getHeaderValue()).isEqualTo("no-store");
} }

@ -711,7 +711,7 @@ public class WebMvcAutoConfigurationTests {
@Test @Test
public void cachePeriod() throws Exception { public void cachePeriod() throws Exception {
this.contextRunner.withPropertyValues("spring.resources.cache-period:5") this.contextRunner.withPropertyValues("spring.resources.cache.period:5")
.run((context) -> assertCachePeriod(context)); .run((context) -> assertCachePeriod(context));
} }
@ -733,8 +733,8 @@ public class WebMvcAutoConfigurationTests {
@Test @Test
public void cacheControl() throws Exception { public void cacheControl() throws Exception {
this.contextRunner this.contextRunner
.withPropertyValues("spring.resources.cache-control.max-age:5", .withPropertyValues("spring.resources.cache.control.max-age:5",
"spring.resources.cache-control.proxy-revalidate:true") "spring.resources.cache.control.proxy-revalidate:true")
.run((context) -> assertCacheControl(context)); .run((context) -> assertCacheControl(context));
} }

@ -52,7 +52,7 @@ public class DevToolsPropertyDefaultsPostProcessor implements EnvironmentPostPro
devToolsProperties.put("spring.mustache.cache", "false"); devToolsProperties.put("spring.mustache.cache", "false");
devToolsProperties.put("server.session.persistent", "true"); devToolsProperties.put("server.session.persistent", "true");
devToolsProperties.put("spring.h2.console.enabled", "true"); devToolsProperties.put("spring.h2.console.enabled", "true");
devToolsProperties.put("spring.resources.cache-period", "0"); devToolsProperties.put("spring.resources.cache.period", "0");
devToolsProperties.put("spring.resources.chain.cache", "false"); devToolsProperties.put("spring.resources.chain.cache", "false");
devToolsProperties.put("spring.template.provider.cache", "false"); devToolsProperties.put("spring.template.provider.cache", "false");
devToolsProperties.put("spring.mvc.log-resolved-exception", "true"); devToolsProperties.put("spring.mvc.log-resolved-exception", "true");

@ -121,7 +121,7 @@ public class LocalDevToolsAutoConfigurationTests {
public void resourceCachePeriodIsZero() throws Exception { public void resourceCachePeriodIsZero() throws Exception {
this.context = initializeAndRun(WebResourcesConfig.class); this.context = initializeAndRun(WebResourcesConfig.class);
ResourceProperties properties = this.context.getBean(ResourceProperties.class); ResourceProperties properties = this.context.getBean(ResourceProperties.class);
assertThat(properties.getCachePeriod()).isEqualTo(Duration.ZERO); assertThat(properties.getCache().getPeriod()).isEqualTo(Duration.ZERO);
} }
@Test @Test

@ -398,18 +398,18 @@ content into your application. Rather, pick only the properties that you need.
# SPRING RESOURCES HANDLING ({sc-spring-boot-autoconfigure}/web/ResourceProperties.{sc-ext}[ResourceProperties]) # SPRING RESOURCES HANDLING ({sc-spring-boot-autoconfigure}/web/ResourceProperties.{sc-ext}[ResourceProperties])
spring.resources.add-mappings=true # Whether to enable default resource handling. spring.resources.add-mappings=true # Whether to enable default resource handling.
spring.resources.cache-control.max-age= # Maximum time the response should be cached, in seconds if no duration suffix is not specified. spring.resources.cache.control.max-age= # Maximum time the response should be cached, in seconds if no duration suffix is not specified.
spring.resources.cache-control.no-cache= # Indicate that the cached response can be reused only if re-validated with the server. spring.resources.cache.control.no-cache= # Indicate that the cached response can be reused only if re-validated with the server.
spring.resources.cache-control.no-store= # Indicate to not cache the response in any case. spring.resources.cache.control.no-store= # Indicate to not cache the response in any case.
spring.resources.cache-control.must-revalidate= # Indicate that once it has become stale, a cache must not use the response without re-validating it with the server. spring.resources.cache.control.must-revalidate= # Indicate that once it has become stale, a cache must not use the response without re-validating it with the server.
spring.resources.cache-control.no-transform= # Indicate intermediaries (caches and others) that they should not transform the response content. spring.resources.cache.control.no-transform= # Indicate intermediaries (caches and others) that they should not transform the response content.
spring.resources.cache-control.cache-public= # Indicate that any cache may store the response. spring.resources.cache.control.cache-public= # Indicate that any cache may store the response.
spring.resources.cache-control.cache-private= # Indicate that the response message is intended for a single user and must not be stored by a shared cache. spring.resources.cache.control.cache-private= # Indicate that the response message is intended for a single user and must not be stored by a shared cache.
spring.resources.cache-control.proxy-revalidate= # Same meaning as the "must-revalidate" directive, except that it does not apply to private caches. spring.resources.cache.control.proxy-revalidate= # Same meaning as the "must-revalidate" directive, except that it does not apply to private caches.
spring.resources.cache-control.stale-while-revalidate= # Maximum time the response can be served after it becomes stale, in seconds if no duration suffix is not specified. spring.resources.cache.control.stale-while-revalidate= # Maximum time the response can be served after it becomes stale, in seconds if no duration suffix is not specified.
spring.resources.cache-control.stale-if-error= # Maximum time the response may be used when errors are encountered, in seconds if no duration suffix is not specified. spring.resources.cache.control.stale-if-error= # Maximum time the response may be used when errors are encountered, in seconds if no duration suffix is not specified.
spring.resources.cache-control.s-max-age= # Maximum time the response should be cached by shared caches, in seconds if no duration suffix is not specified. spring.resources.cache.control.s-max-age= # Maximum time the response should be cached by shared caches, in seconds if no duration suffix is not specified.
spring.resources.cache-period= # Cache period for the resources served by the resource handler. If a duration suffix is not specified, seconds will be used. spring.resources.cache.period= # Cache period for the resources served by the resource handler. If a duration suffix is not specified, seconds will be used.
spring.resources.chain.cache=true # Whether to enable caching in the Resource chain. spring.resources.chain.cache=true # Whether to enable caching in the Resource chain.
spring.resources.chain.enabled= # Whether to enable the Spring Resource Handling chain. By default, disabled unless at least one strategy has been enabled. spring.resources.chain.enabled= # Whether to enable the Spring Resource Handling chain. By default, disabled unless at least one strategy has been enabled.
spring.resources.chain.gzipped=false # Whether to enable resolution of already gzipped resources. spring.resources.chain.gzipped=false # Whether to enable resolution of already gzipped resources.
@ -588,7 +588,7 @@ content into your application. Rather, pick only the properties that you need.
spring.data.cassandra.pool.idle-timeout=120 # Idle timeout before an idle connection is removed. If a duration suffix is not specified, seconds will be used. spring.data.cassandra.pool.idle-timeout=120 # Idle timeout before an idle connection is removed. If a duration suffix is not specified, seconds will be used.
spring.data.cassandra.pool.max-queue-size=256 # Maximum number of requests that get queued if no connection is available. spring.data.cassandra.pool.max-queue-size=256 # Maximum number of requests that get queued if no connection is available.
spring.data.cassandra.pool.pool-timeout=5000ms # Pool timeout when trying to acquire a connection from a host's pool. spring.data.cassandra.pool.pool-timeout=5000ms # Pool timeout when trying to acquire a connection from a host's pool.
spring.data.cassandra.reactive-repositories.enabled=true # Whether to enable Cassandra reactive repositories. spring.data.cassandra.reactiverepositories.enabled=true # Whether to enable Cassandra reactive repositories.
spring.data.cassandra.read-timeout= # Socket option: read time out. spring.data.cassandra.read-timeout= # Socket option: read time out.
spring.data.cassandra.reconnection-policy= # Reconnection policy class. spring.data.cassandra.reconnection-policy= # Reconnection policy class.
spring.data.cassandra.repositories.enabled= # Enable Cassandra repositories. spring.data.cassandra.repositories.enabled= # Enable Cassandra repositories.
@ -601,7 +601,7 @@ content into your application. Rather, pick only the properties that you need.
# DATA COUCHBASE ({sc-spring-boot-autoconfigure}/data/couchbase/CouchbaseDataProperties.{sc-ext}[CouchbaseDataProperties]) # DATA COUCHBASE ({sc-spring-boot-autoconfigure}/data/couchbase/CouchbaseDataProperties.{sc-ext}[CouchbaseDataProperties])
spring.data.couchbase.auto-index=false # Automatically create views and indexes. spring.data.couchbase.auto-index=false # Automatically create views and indexes.
spring.data.couchbase.consistency=read-your-own-writes # Consistency to apply by default on generated queries. spring.data.couchbase.consistency=read-your-own-writes # Consistency to apply by default on generated queries.
spring.data.couchbase.reactive-repositories.enabled=true # Enable Couchbase reactive repositories. spring.data.couchbase.reactiverepositories.enabled=true # Enable Couchbase reactive repositories.
spring.data.couchbase.repositories.enabled=true # Enable Couchbase repositories. spring.data.couchbase.repositories.enabled=true # Enable Couchbase repositories.
# ELASTICSEARCH ({sc-spring-boot-autoconfigure}/data/elasticsearch/ElasticsearchProperties.{sc-ext}[ElasticsearchProperties]) # ELASTICSEARCH ({sc-spring-boot-autoconfigure}/data/elasticsearch/ElasticsearchProperties.{sc-ext}[ElasticsearchProperties])
@ -621,7 +621,7 @@ content into your application. Rather, pick only the properties that you need.
spring.data.mongodb.host=localhost # Mongo server host. Cannot be set with URI. spring.data.mongodb.host=localhost # Mongo server host. Cannot be set with URI.
spring.data.mongodb.password= # Login password of the mongo server. Cannot be set with URI. spring.data.mongodb.password= # Login password of the mongo server. Cannot be set with URI.
spring.data.mongodb.port=27017 # Mongo server port. Cannot be set with URI. spring.data.mongodb.port=27017 # Mongo server port. Cannot be set with URI.
spring.data.mongodb.reactive-repositories.enabled=true # Whether to enable Mongo reactive repositories. spring.data.mongodb.reactiverepositories.enabled=true # Whether to enable Mongo reactive repositories.
spring.data.mongodb.repositories.enabled=true # Whether to enable Mongo repositories. spring.data.mongodb.repositories.enabled=true # Whether to enable Mongo repositories.
spring.data.mongodb.uri=mongodb://localhost/test # Mongo database URI. Cannot be set with host, port and credentials. spring.data.mongodb.uri=mongodb://localhost/test # Mongo database URI. Cannot be set with host, port and credentials.
spring.data.mongodb.username= # Login user of the mongo server. Cannot be set with URI. spring.data.mongodb.username= # Login user of the mongo server. Cannot be set with URI.

Loading…
Cancel
Save