Skip to content
Permalink
Browse files

Disable resource cache when DevTools is enabled

Closes gh-3794
Closes gh-3739
  • Loading branch information
htynkn authored and snicoll committed Aug 20, 2015
1 parent 5aa222a commit 4e410681aa77f44b61f27542ec29308008412d42
@@ -46,6 +46,7 @@
properties.put("spring.mustache.cache", "false");
properties.put("server.session.persistent", "true");
properties.put("spring.h2.console.enabled", "true");
properties.put("spring.resources.cache-period", "0");
PROPERTIES = Collections.unmodifiableMap(properties);
}

@@ -28,6 +28,7 @@
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration;
import org.springframework.boot.autoconfigure.web.ResourceProperties;
import org.springframework.boot.devtools.classpath.ClassPathChangedEvent;
import org.springframework.boot.devtools.classpath.ClassPathFileSystemWatcher;
import org.springframework.boot.devtools.filewatch.ChangedFiles;
@@ -89,6 +90,13 @@ public void thymeleafCacheIsFalse() throws Exception {
assertThat(resolver.isCacheable(), equalTo(false));
}

@Test
public void resourceCachePeriodIsZero() throws Exception {
this.context = initializeAndRun(WebResourcesConfig.class);
ResourceProperties properties = this.context.getBean(ResourceProperties.class);
assertThat(properties.getCachePeriod(), equalTo(0));
}

@Test
public void liveReloadServer() throws Exception {
this.context = initializeAndRun(Config.class);
@@ -242,4 +250,9 @@ public LiveReloadServer liveReloadServer() {

}

@Configuration
@Import({ LocalDevToolsAutoConfiguration.class, ResourceProperties.class })
public static class WebResourcesConfig {

}
}

0 comments on commit 4e41068

Please sign in to comment.
You can’t perform that action at this time.