SpringBoot官方文档翻译(二十一):默认属性

20.1 Property Defaults(默认属性)

1
2
3
4
5
Several of the libraries supported by Spring Boot use     
caches to improve performance. For example, template
engines cache compiled templates to avoid repeatedly
parsing template files. Also, Spring MVC can add HTTP
caching headers to responses when serving static resources.

Spring Boot支持几个库使用缓存来提升性能。比如,模板引擎缓存编译模板以避免重复
解析模板文件。同样的,Spring MVC在服务静态资源的时候,能将HTTP的header缓存到应答当中。

1
2
3
4
5
While caching is very beneficial in production, it can be     
counter-productive during development, preventing you from
seeing the changes you just made in your application.
For this reason, spring-boot-devtools disables the caching
options by default.

虽然缓存在生产中非常有益,但在开发阶段有时候会适得其反,阻止您看到您应用最新的改动。基于此,spring-boot-devtools会默认禁用缓存。

1
2
3
4
5
6
Cache options are usually configured by settings in     
your application.properties file. For example, Thymeleaf
offers the spring.thymeleaf.cache property. Rather than
needing to set these properties manually, the 
spring-boot-devtools module automatically applies sensible
development-time configuration.

缓存选项通常会被配置于您的application.properties文件。举个例子,Thymeleaf提供了spring.thymeleaf.cache属性。spring-boot-devtools将会自动应用合理的配置,而不是通过手动设置这些属性。

1
2
For a complete list of the properties that are applied     
by the devtools, see DevToolsPropertyDefaultsPostProcessor.

想要查看devtools完整的属性,请参考“https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsPropertyDefaultsPostProcessor.java”

分享到