Spring-Boot 相關的一些配置

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

mobile

  • spring.mobile.devicedelegatingviewresolver.enable-fallback是否支持fallback的解決方案,默認false

  • spring.mobile.devicedelegatingviewresolver.enabled是否開始device view resolver,默認為: false

  • spring.mobile.devicedelegatingviewresolver.mobile-prefix設定mobile端視圖的前綴,默認為:mobile/

  • spring.mobile.devicedelegatingviewresolver.mobile-suffix設定mobile視圖的后綴

  • spring.mobile.devicedelegatingviewresolver.normal-prefix設定普通設備的視圖前綴

  • spring.mobile.devicedelegatingviewresolver.normal-suffix設定普通設備視圖的后綴

  • spring.mobile.devicedelegatingviewresolver.tablet-prefix設定平板設備視圖前綴,默認:tablet/

  • spring.mobile.devicedelegatingviewresolver.tablet-suffix設定平板設備視圖后綴.

  • spring.mobile.sitepreference.enabled是否啟用SitePreferenceHandler,默認為: true

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.chain.enabled是否開啟資源 handling chain,默認為false

  • spring.resources.chain.html-application-cache是否開啟h5應用的cache manifest重寫,默認為: false

  • spring.resources.chain.strategy.content.enabled是否開啟內容版本策略,默認為false

  • spring.resources.chain.strategy.content.paths指定要應用的版本的路徑,多個以逗號分隔,默認為:[/**]

  • spring.resources.chain.strategy.fixed.enabled是否開啟固定的版本策略,默認為false

  • spring.resources.chain.strategy.fixed.paths指定要應用版本策略的路徑,多個以逗號分隔

  • spring.resources.chain.strategy.fixed.version指定版本策略使用的版本號

  • 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

freemarker

  • spring.freemarker.allow-request-override指定HttpServletRequest的屬性是否可以覆蓋controller的model的同名項

  • spring.freemarker.allow-session-override指定HttpSession的屬性是否可以覆蓋controller的model的同名項

  • spring.freemarker.cache是否開啟template caching.

  • spring.freemarker.charset設定Template的編碼.

  • spring.freemarker.check-template-location是否檢查templates路徑是否存在.

  • spring.freemarker.content-type設定Content-Type.

  • spring.freemarker.enabled是否允許mvc使用freemarker.

  • spring.freemarker.expose-request-attributes設定所有request的屬性在merge到模板的時候,是否要都添加到model中.

  • spring.freemarker.expose-session-attributes設定所有HttpSession的屬性在merge到模板的時候,是否要都添加到model中.

  • spring.freemarker.expose-spring-macro-helpers設定是否以springMacroRequestContext的形式暴露RequestContext給Spring’s macro library使用

  • spring.freemarker.prefer-file-system-access是否優先從文件系統加載template,以支持熱加載,默認為true

  • spring.freemarker.prefix設定freemarker模板的前綴.

  • spring.freemarker.request-context-attribute指定RequestContext屬性的名.

  • spring.freemarker.settings設定FreeMarker keys.

  • spring.freemarker.suffix設定模板的后綴.

  • spring.freemarker.template-loader-path設定模板的加載路徑,多個以逗號分隔,默認: ["classpath:/templates/"]

  • spring.freemarker.view-names指定使用模板的視圖列表.

velocity

  • spring.velocity.allow-request-override指定HttpServletRequest的屬性是否可以覆蓋controller的model的同名項

  • spring.velocity.allow-session-override指定HttpSession的屬性是否可以覆蓋controller的model的同名項

  • spring.velocity.cache是否開啟模板緩存

  • spring.velocity.charset設定模板編碼

  • spring.velocity.check-template-location是否檢查模板路徑是否存在.

  • spring.velocity.content-type設定ContentType的值

  • spring.velocity.date-tool-attribute設定暴露給velocity上下文使用的DateTool的名

  • spring.velocity.enabled設定是否允許mvc使用velocity

  • spring.velocity.expose-request-attributes是否在merge模板的時候,將request屬性都添加到model中

  • spring.velocity.expose-session-attributes是否在merge模板的時候,將HttpSession屬性都添加到model中

  • spring.velocity.expose-spring-macro-helpers設定是否以springMacroRequestContext的名來暴露RequestContext給Spring’s macro類庫使用

  • spring.velocity.number-tool-attribute設定暴露給velocity上下文的NumberTool的名

  • spring.velocity.prefer-file-system-access是否優先從文件系統加載模板以支持熱加載,默認為true

  • spring.velocity.prefix設定velocity模板的前綴.

  • spring.velocity.properties設置velocity的額外屬性.

  • spring.velocity.request-context-attribute設定RequestContext attribute的名.

  • spring.velocity.resource-loader-path設定模板路徑,默認為: classpath:/templates/

  • spring.velocity.suffix設定velocity模板的后綴.

  • spring.velocity.toolbox-config-location設定Velocity Toolbox配置文件的路徑,比如 /WEB-INF/toolbox.xml.

  • spring.velocity.view-names設定需要解析的視圖名稱.

thymeleaf

  • spring.thymeleaf.cache是否開啟模板緩存,默認true

  • spring.thymeleaf.check-template-location是否檢查模板路徑是否存在,默認true

  • 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/

  • spring.thymeleaf.suffix指定模板的后綴,默認為:.html

  • spring.thymeleaf.template-resolver-order指定模板的解析順序,默認為第一個.

  • spring.thymeleaf.view-names指定使用模板的視圖名,多個以逗號分隔.

mustcache

  • spring.mustache.cache是否Enable template caching.

  • spring.mustache.charset指定Template的編碼.

  • spring.mustache.check-template-location是否檢查默認的路徑是否存在.

  • spring.mustache.content-type指定Content-Type.

  • spring.mustache.enabled是否開啟mustcache的模板支持.

  • spring.mustache.prefix指定模板的前綴,默認: classpath:/templates/

  • spring.mustache.suffix指定模板的后綴,默認: .html

  • spring.mustache.view-names指定要使用模板的視圖名.

groovy模板

  • spring.groovy.template.allow-request-override指定HttpServletRequest的屬性是否可以覆蓋controller的model的同名項

  • spring.groovy.template.allow-session-override指定HttpSession的屬性是否可以覆蓋controller的model的同名項

  • spring.groovy.template.cache是否開啟模板緩存.

  • spring.groovy.template.charset指定Template編碼.

  • spring.groovy.template.check-template-location是否檢查模板的路徑是否存在.

  • spring.groovy.template.configuration.auto-escape是否在渲染模板時自動排查model的變量,默認為: false

  • spring.groovy.template.configuration.auto-indent是否在渲染模板時自動縮進,默認為false

  • spring.groovy.template.configuration.auto-indent-string如果自動縮進啟用的話,是使用SPACES還是TAB,默認為: SPACES

  • spring.groovy.template.configuration.auto-new-line渲染模板時是否要輸出換行,默認為false

  • spring.groovy.template.configuration.base-template-class指定template base class.

  • spring.groovy.template.configuration.cache-templates是否要緩存模板,默認為true

  • spring.groovy.template.configuration.declaration-encoding在寫入declaration header時使用的編碼

  • spring.groovy.template.configuration.expand-empty-elements是使用這種形式,還是
    這種展開模式,默認為: false

  • spring.groovy.template.configuration.locale指定template locale.

  • spring.groovy.template.configuration.new-line-string當啟用自動換行時,換行的輸出,默認為系統的line.separator屬性的值

  • spring.groovy.template.configuration.resource-loader-path指定groovy的模板路徑,默認為classpath:/templates/

  • spring.groovy.template.configuration.use-double-quotes指定屬性要使用雙引號還是單引號,默認為false

  • spring.groovy.template.content-type指定Content-Type.

  • spring.groovy.template.enabled是否開啟groovy模板的支持.

  • spring.groovy.template.expose-request-attributes設定所有request的屬性在merge到模板的時候,是否要都添加到model中.

  • spring.groovy.template.expose-session-attributes設定所有request的屬性在merge到模板的時候,是否要都添加到model中.

  • spring.groovy.template.expose-spring-macro-helpers設定是否以springMacroRequestContext的形式暴露RequestContext給Spring’s macro library使用

  • spring.groovy.template.prefix指定模板的前綴.

  • spring.groovy.template.request-context-attribute指定RequestContext屬性的名.

  • spring.groovy.template.resource-loader-path指定模板的路徑,默認為: classpath:/templates/

  • spring.groovy.template.suffix指定模板的后綴

  • spring.groovy.template.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.

jersey

  • spring.jersey.filter.order指定Jersey filter的order,默認為: 0

  • spring.jersey.init指定傳遞給Jersey的初始化參數.

  • spring.jersey.type指定Jersey的集成類型,可以是servlet或者filter.

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容