Springboot Properties 2306
>spring.freemarker 模板属性
Name | Description | Default Value |
---|---|---|
Whether HttpServletRequest attributes are allowed to override (hide) controller generated model attributes of the same name. |
| |
Whether HttpSession attributes are allowed to override (hide) controller generated model attributes of the same name. |
| |
Whether to enable template caching. |
| |
Template encoding. |
| |
Whether to check that the templates location exists. |
| |
Content-Type value. |
| |
Whether to enable MVC view resolution for this technology. |
| |
Whether all request attributes should be added to the model prior to merging with the template. |
| |
Whether all HttpSession attributes should be added to the model prior to merging with the template. |
| |
Whether to expose a RequestContext for use by Spring's macro library, under the name "springMacroRequestContext". |
| |
Whether to prefer file system access for template loading to enable hot detection of template changes. When a template path is detected as a directory, templates are loaded from the directory only and other matching classpath locations will not be considered. |
| |
Prefix that gets prepended to view names when building a URL. | ||
Name of the RequestContext attribute for all views. | ||
Well-known FreeMarker keys which are passed to FreeMarker's Configuration. | ||
Suffix that gets appended to view names when building a URL. |
| |
Comma-separated list of template paths. |
| |
View names that can be resolved. |
### 是否启用freemarker , Whether to enable MVC view resolution for this technology? 默认 true
spring.freemarker.enabled: true
### 设定模板的前缀, 默认值是 空白
spring.freemarker.prefix:
### 设定模板的后缀, 默认值是 .ftlh
spring.freemarker.suffix:
### Content-Type value.
######## 默认值为 text/html
#spring.freemarker.content-type: text/html
######## 当值不为 text/html时, 浏览器无法直接访问, 会显示404, 但同源ajax可以
#spring.freemarker.content-type: text/plain
#spring.freemarker.content-type: text/JavaScript
### 模板编码。 默认是 UTF-8
spring.freemarker.charset: UTF-8
### 设定模板的加载路径,多个以逗号分隔,默认: [classpath:/templates/]
spring.freemarker.template-loader-path: classpath:/templates/
### 是否检查模板位置是否存在。 默认是 true;
spring.freemarker.check-template-location: false
### 是否启用模板缓存。 默认 false
spring.freemarker.cache: false
### 是否优先从文件系统加载模板,以支持热加载,默认为false
spring.freemarker.prefer-file-system-access: true
### 是否允许HttpServletRequest属性覆盖(隐藏)控制器生成的同名模型属性。 默认 false
spring.freemarker.allow-request-override: false
### 是否允许HttpSession属性覆盖(隐藏)控制器生成的同名模型属性。 默认false
spring.freemarker.allow-session-override: false
### 设定所有request的属性在merge到模板的时候,是否要都添加到model中. 默认false
spring.freemarker.expose-request-attributes: false
### 是否在merge模板的时候,将HttpSession属性都添加到model中, 默认false
spring.freemarker.expose-session-attributes: false
### 设定是否以springMacroRequestContext的形式暴露RequestContext给Spring’s macro library使用, 默认true
spring.freemarker.expose-spring-macro-helpers: true
### views的白名单
### 可以解析view的清单(白名单) 默认不存在, 空白会阻止所有view , 开头有没有斜杠"/"必须和Controller的返回完全匹配
### spring.freemarker.view-names: 后面空白会阻止所有view, 一般可以去掉或注释掉, 下面是一些用法例子 可以用数组,也可以不用
#spring.freemarker.view-names: txt/txt.txt
#spring.freemarker.view-names: txt/txt.txt , txt/txt2.txt, 'ftl/ftl.ftl', "ftlh/ftlh.ftlh"
#spring.freemarker.view-names: [txt/txt.txt , txt/txt2.txt, ftl/ftl.ftl, ftlh/ftlh.ftlh]
#spring.freemarker.view-names: ['txt/txt.txt' , "txt/txt2.txt", ftl/ftl.ftl, ftlh/ftlh.ftlh]
#spring.freemarker.view-names:
# - 'txt/txt.txt'
# - "txt/txt2.txt"
# - ftl/ftl.ftl
# - ftlh/ftlh.ftlh
# - 可以加单双引号/也可以不加
### 设定FreeMarker keys.
spring.freemarker.settings.template_update_delay: 0
spring.freemarker.settings.default_encoding: UTF-8
spring.freemarker.settings.classic_compatible: true
是否启用freemarker , Whether to enable MVC view resolution for this technology? 默认 true
spring.freemarker.enabled: true
设定模板的前缀, 默认值是 空白
spring.freemarker.prefix:
设定模板的后缀, 默认值是 .ftlh
spring.freemarker.suffix:
Content-Type value.
默认值为 text/html
#spring.freemarker.content-type: text/html
当值不为 text/html时, 浏览器无法直接访问, 会显示404, 但同源ajax可以
#spring.freemarker.content-type: text/plain
#spring.freemarker.content-type: text/JavaScript
模板编码。 默认是 UTF-8
spring.freemarker.charset: UTF-8
设定模板的加载路径,多个以逗号分隔,默认: [classpath:/templates/]
spring.freemarker.template-loader-path: classpath:/templates/
是否检查模板位置是否存在。 默认是 true;
spring.freemarker.check-template-location: false
是否启用模板缓存。 默认 false
spring.freemarker.cache: false
是否优先从文件系统加载模板,以支持热加载,默认为false
spring.freemarker.prefer-file-system-access: true
是否允许HttpServletRequest属性覆盖(隐藏)控制器生成的同名模型属性。 默认 false
spring.freemarker.allow-request-override: false
是否允许HttpSession属性覆盖(隐藏)控制器生成的同名模型属性。 默认false
spring.freemarker.allow-session-override: false
设定所有request的属性在merge到模板的时候,是否要都添加到model中. 默认false
spring.freemarker.expose-request-attributes: false
是否在merge模板的时候,将HttpSession属性都添加到model中, 默认false
spring.freemarker.expose-session-attributes: false
设定是否以springMacroRequestContext的形式暴露RequestContext给Spring’s macro library使用, 默认true
spring.freemarker.expose-spring-macro-helpers: true
views的白名单
可以解析view的清单(白名单) 默认不存在, 空白会阻止所有view , 开头有没有斜杠"/"必须和Controller的返回完全匹配
spring.freemarker.view-names: 后面空白会阻止所有view, 一般可以去掉或注释掉, 下面是一些用法例子 可以用数组,也可以不用
#spring.freemarker.view-names: txt/txt.txt
#spring.freemarker.view-names: txt/txt.txt , txt/txt2.txt, ‘ftl/ftl.ftl’, “ftlh/ftlh.ftlh”
#spring.freemarker.view-names: [txt/txt.txt , txt/txt2.txt, ftl/ftl.ftl, ftlh/ftlh.ftlh]
#spring.freemarker.view-names: [‘txt/txt.txt’ , “txt/txt2.txt”, ftl/ftl.ftl, ftlh/ftlh.ftlh]
#spring.freemarker.view-names:
– ‘txt/txt.txt’
– “txt/txt2.txt”
– ftl/ftl.ftl
– ftlh/ftlh.ftlh
– 可以加单双引号/也可以不加
设定FreeMarker keys.
spring.freemarker.settings.template_update_delay: 0
spring.freemarker.settings.default_encoding: UTF-8
spring.freemarker.settings.classic_compatible: true