Move spring.resources.* properties to spring.web.resources.*
Closes gh-23917
This commit is contained in:
@@ -35,7 +35,8 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ResourceProperties;
|
||||
import org.springframework.boot.autoconfigure.web.WebProperties;
|
||||
import org.springframework.boot.autoconfigure.web.WebProperties.Resources;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration;
|
||||
import org.springframework.boot.devtools.classpath.ClassPathChangedEvent;
|
||||
import org.springframework.boot.devtools.classpath.ClassPathFileSystemWatcher;
|
||||
@@ -113,7 +114,17 @@ class LocalDevToolsAutoConfigurationTests {
|
||||
@Test
|
||||
void resourceCachePeriodIsZero() throws Exception {
|
||||
this.context = getContext(() -> initializeAndRun(WebResourcesConfig.class));
|
||||
ResourceProperties properties = this.context.getBean(ResourceProperties.class);
|
||||
Resources properties = this.context.getBean(WebProperties.class).getResources();
|
||||
assertThat(properties.getCache().getPeriod()).isZero();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test
|
||||
void deprecatedResourceCachePeriodIsZeroWhenDeprecatedResourcePropertiesAreInUse() throws Exception {
|
||||
this.context = getContext(() -> initializeAndRun(WebResourcesConfig.class,
|
||||
Collections.singletonMap("spring.resources.add-mappings", false)));
|
||||
Resources properties = this.context
|
||||
.getBean(org.springframework.boot.autoconfigure.web.ResourceProperties.class);
|
||||
assertThat(properties.getCache().getPeriod()).isZero();
|
||||
}
|
||||
|
||||
@@ -282,9 +293,10 @@ class LocalDevToolsAutoConfigurationTests {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Import({ ServletWebServerFactoryAutoConfiguration.class, LocalDevToolsAutoConfiguration.class,
|
||||
ResourceProperties.class })
|
||||
@Import({ ServletWebServerFactoryAutoConfiguration.class, LocalDevToolsAutoConfiguration.class, WebProperties.class,
|
||||
org.springframework.boot.autoconfigure.web.ResourceProperties.class })
|
||||
static class WebResourcesConfig {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user