欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

SpringBoot 整合 Freemarker properties配置详细说明

程序员文章站 2022-07-14 09:54:56
...

参考:https://ifeve.com/spring-boot-%E9%9B%86%E6%88%90-freemarker-%E8%AF%A6%E8%A7%A3%E6%A1%88%E4%BE%8B/

## Freemarker 配置
## 文件配置路径
spring.freemarker.template-loader-path=classpath:/templates/
spring.freemarker.cache=false
spring.freemarker.charset=UTF-8
spring.freemarker.check-template-location=true
spring.freemarker.content-type=text/html
spring.freemarker.expose-request-attributes=true
spring.freemarker.expose-session-attributes=true
spring.freemarker.request-context-attribute=request
spring.freemarker.suffix=.ftl

如果需要更多的 FreeMarker 配置,可以查看下面的详解:

spring.freemarker.allow-request-override=false # Set whether HttpServletRequest attributes are allowed to override (hide) controller generated model attributes of the same name.
spring.freemarker.allow-session-override=false # Set whether HttpSession attributes are allowed to override (hide) controller generated model attributes of the same name.
spring.freemarker.cache=false # Enable template caching.
spring.freemarker.charset=UTF-8 # Template encoding.
spring.freemarker.check-template-location=true # Check that the templates location exists.
spring.freemarker.content-type=text/html # Content-Type value.
spring.freemarker.enabled=true # Enable MVC view resolution for this technology.
spring.freemarker.expose-request-attributes=false # Set whether all request attributes should be added to the model prior to merging with the template.
spring.freemarker.expose-session-attributes=false # Set whether all HttpSession attributes should be added to the model prior to merging with the template.
spring.freemarker.expose-spring-macro-helpers=true # Set whether to expose a RequestContext for use by Spring's macro library, under the name "springMacroRequestContext".
spring.freemarker.prefer-file-system-access=true # Prefer file system access for template loading. File system access enables hot detection of template changes.
spring.freemarker.prefix= # Prefix that gets prepended to view names when building a URL.
spring.freemarker.request-context-attribute= # Name of the RequestContext attribute for all views.
spring.freemarker.settings.*= # Well-known FreeMarker keys which will be passed to FreeMarker's Configuration.
spring.freemarker.suffix= # Suffix that gets appended to view names when building a URL.
spring.freemarker.template-loader-path=classpath:/templates/ # Comma-separated list of template paths.
spring.freemarker.view-names= # White list of view names that can be resolved.
#配置freemarker详解

#spring.freemarker.allow-request-override=false 
# Set whether HttpServletRequest attributes are allowed to override (hide) controller generated model attributes of the same name.
#设置是否允许HttpServletRequest属性覆盖(隐藏)控制器生成的同名模型属性。

#spring.freemarker.allow-session-override=false 
# Set whether HttpSession attributes are allowed to override (hide) controller generated model attributes of the same name.
#设置是否允许HttpSession属性覆盖(隐藏)控制器生成的同名模型属性。

#spring.freemarker.cache=false 
# Enable template caching.
#启用模板缓存。

#spring.freemarker.charset=UTF-8 
# Template encoding.
#设置编码格式

#spring.freemarker.check-template-location=true 
# Check that the templates location exists.
#检查模板位置是否存在。

#spring.freemarker.content-type=text/html 
# Content-Type value.
#内容类型值

#spring.freemarker.enabled=true 
# Enable MVC view resolution for this technology.
#为这种技术启用MVC视图解决方案。

#spring.freemarker.expose-request-attributes=false 
# Set whether all request attributes should be added to the model prior to merging with the template.
#设置是否应该在与模板合并之前将所有请求属性添加到模型中。

#spring.freemarker.expose-session-attributes=false 
# Set whether all HttpSession attributes should be added to the model prior to merging with the template.
#设置是否在与模板合并之前将所有HttpSession属性添加到模型中。

#spring.freemarker.expose-spring-macro-helpers=true 
# Set whether to expose a RequestContext for use by Spring's macro library, under the name "springMacroRequestContext".
#设置是否公开RequestContext供Spring宏库使用,名称为“SpringMacroRequestContext”。

#spring.freemarker.prefer-file-system-access=true 
# Prefer file system access for template loading. File system access enables hot detection of template changes.
#更喜欢文件系统访问模板加载。文件系统访问允许对模板更改进行热检测。

#spring.freemarker.prefix= 
# Prefix that gets prepended to view names when building a URL.
#前缀,用于在构建URL时查看名称

#spring.freemarker.request-context-attribute= 
# Name of the RequestContext attribute for all views.
#所有视图的RequestContext属性的名称。

#spring.freemarker.settings.*= 
# Well-known FreeMarker keys which will be passed to FreeMarker's Configuration.
#众所周知的FreeMarker**将传递给FreeMarker的配置。

#spring.freemarker.suffix= 
# Suffix that gets appended to view names when building a URL.
#后缀,该后缀用于在构建URL时查看名称。

#spring.freemarker.template-loader-path=classpath:/templates/  
# Comma-separated list of template paths.
#以逗号分隔的模板路径列表。

#spring.freemarker.view-names= 
# White list of view names that can be resolved.
#可以解析的视图名称的白列表。