mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Fix ignored use-last-modified property in Spring MVC
Prior to this commit, the `spring.web.resources.cache.use-last-modified` configuration property support was lost during a merge operation right before 2.4.2. This is due to an invalid test that missed this unintended change. This commit fixes both problems. Fixes gh-26212
This commit is contained in:
parent
e424c1c4b4
commit
7be9c268b8
@ -426,6 +426,7 @@ public class WebMvcAutoConfiguration {
|
||||
customizer.accept(registration);
|
||||
registration.setCachePeriod(getSeconds(this.resourceProperties.getCache().getPeriod()));
|
||||
registration.setCacheControl(this.resourceProperties.getCache().getCachecontrol().toHttpCacheControl());
|
||||
registration.setUseLastModified(this.resourceProperties.getCache().isUseLastModified());
|
||||
customizeResourceHandlerRegistration(registration);
|
||||
}
|
||||
|
||||
|
@ -1009,7 +1009,7 @@ class WebMvcAutoConfigurationTests {
|
||||
Consumer<ResourceHttpRequestHandler> handlerConsumer) {
|
||||
Map<String, Object> handlerMap = getHandlerMap(context.getBean("resourceHandlerMapping", HandlerMapping.class));
|
||||
assertThat(handlerMap).hasSize(2);
|
||||
for (Object handler : handlerMap.keySet()) {
|
||||
for (Object handler : handlerMap.values()) {
|
||||
if (handler instanceof ResourceHttpRequestHandler) {
|
||||
handlerConsumer.accept((ResourceHttpRequestHandler) handler);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user