前言:springboot集成了主流的第三方框架,但是需要使用springboot那一套配置方式。但是我这里只列举了非常非常常用的,可以看已发的几篇博客,慢慢会补充。当然官方文档里也有相应的配置,可惜没有注释。
mvc
-
spring.mvc.async.request-timeout
设定async请求的超时时间,以毫秒为单位,如果没有设置的话,以具体实现的超时时间为准,比如tomcat的servlet3的话是10秒. -
spring.mvc.date-format
设定日期的格式,比如dd/MM/yyyy. -
spring.mvc.favicon.enabled
是否支持favicon.ico,默认为: true -
spring.mvc.ignore-default-model-on-redirect
在重定向时是否忽略默认model的内容,默认为true -
spring.mvc.locale
指定使用的Locale. -
spring.mvc.message-codes-resolver-format
指定message codes的格式化策略(PREFIX_ERROR_CODE,POSTFIX_ERROR_CODE). -
spring.mvc.view.prefix
指定mvc视图的前缀. -
spring.mvc.view.suffix
指定mvc视图的后缀.
messages
-
spring.messages.basename
指定message的basename,多个以逗号分隔,如果不加包名的话,默认从classpath路径开始,默认: messages -
spring.messages.cache-seconds
设定加载的资源文件缓存失效时间,-1的话为永不过期,默认为-1 -
spring.messages.encoding
设定Message bundles的编码,默认: UTF-8
view
-
spring.view.prefix
设定mvc视图的前缀. -
spring.view.suffix
设定mvc视图的后缀.
resource
-
spring.resources.add-mappings
是否开启默认的资源处理,默认为true -
spring.resources.cache-period
设定资源的缓存时效,以秒为单位. -
spring.resources.chain.cache
是否开启缓存,默认为: true -
spring.resources.static-locations
指定静态资源路径,默认为classpath:[/META-INF/resources/,/resources/, /static/, /public/]以及context:/
multipart
-
multipart.enabled
是否开启文件上传支持,默认为true -
multipart.file-size-threshold
设定文件写入磁盘的阈值,单位为MB或KB,默认为0 -
multipart.location
指定文件上传路径. -
multipart.max-file-size
指定文件大小最大值,默认1MB -
multipart.max-request-size
指定每次请求的最大值,默认为10MB
thymeleaf
-
spring.thymeleaf.cache
是否开启模板缓存,默认true,实际开发推荐使用false,这样可以实时同步前端代码和前端界面 -
spring.thymeleaf.check-template-location
是否检查模板路径是否存在,默认true,如果需要在配置类中配置页面访问路径,也就是之前配置文件中的的view-controller,需要设为false,否则在handler中return访问路径时无法根据返回值找到与之匹配的view-controller中的前端页面值 -
spring.thymeleaf.content-type
指定Content-Type,默认为: text/html -
spring.thymeleaf.enabled
是否允许MVC使用Thymeleaf,默认为: true -
spring.thymeleaf.encoding
指定模板的编码,默认为: UTF-8 -
spring.thymeleaf.excluded-view-names
指定不使用模板的视图名称,多个以逗号分隔. -
spring.thymeleaf.mode
指定模板的模式,具体查看StandardTemplateModeHandlers,默认为: HTML5 -
spring.thymeleaf.prefix
指定模板的前缀,默认为:classpath:/templates/,如要更换thymleaf的文件夹目录一定要对此进行修改 -
spring.thymeleaf.suffix
指定模板的后缀,默认为:.html,如有修改一定要写在这里 -
spring.thymeleaf.template-resolver-order
指定模板的解析顺序,默认为第一个. -
spring.thymeleaf.view-names
指定使用模板的视图名,多个以逗号分隔.
http
spring.hateoas.apply-to-primary-object-mapper
设定是否对object mapper也支持HATEOAS,默认为: true
spring.http.converters.preferred-json-mapper
是否优先使用JSON mapper来转换.
spring.http.encoding.charset
指定http请求和相应的Charset,默认: UTF-8
spring.http.encoding.enabled
是否开启http的编码支持,默认为true
spring.http.encoding.force
是否强制对http请求和响应进行编码,默认为true
json
-
spring.jackson.date-format
指定日期格式,比如yyyy-MM-dd HH:mm:ss,或者具体的格式化类的全限定名 -
spring.jackson.deserialization
是否开启Jackson的反序列化 -
spring.jackson.generator
是否开启json的generators. -
spring.jackson.joda-date-time-format
指定Joda date/time的格式,比如yyyy-MM-dd HH:mm:ss). 如果没有配置的话,dateformat会作为backup -
spring.jackson.locale
指定json使用的Locale. -
spring.jackson.mapper
是否开启Jackson通用的特性. -
spring.jackson.parser
是否开启jackson的parser特性. -
spring.jackson.property-naming-strategy
指定PropertyNamingStrategy (CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES)或者指定PropertyNamingStrategy子类的全限定类名. -
spring.jackson.serialization
是否开启jackson的序列化. -
spring.jackson.serialization-inclusion
指定序列化时属性的inclusion方式,具体查看JsonInclude.Include枚举. -
spring.jackson.time-zone
指定日期格式化时区,比如America/Los_Angeles或者GMT+10.