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
    是使用<br/>这种形式,还是<br></br>这种展开模式,默认为: 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.

原文地址:https://www.cnblogs.com/Zz-maker/p/11255769.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


背景:    8月29日,凌晨4点左右,某服务告警,其中一个节点直接down掉,收到告警的同事让运维重启。    9点左右,内存监控上发现内存异常,堆内存涨速很快,即便GC也没有什么效果,频繁GC。    9点38,服务各种超时,影响整个app使用。处理方式:    当时由于很想要
https://support.smartbear.comeadyapi/docs/soapui/steps/groovy.htmlGettestcaseobjectToobtaintheobjectwhichreferstothecontainingtestcase,usethefollowingcodesnippet:Groovy def case=testRunner.testCase; Byusingthe tes
有几个选项可用于执行自定义JMeter脚本并扩展基线JMeter功能。查看最流行的扩展机制,比较性能并分析哪一个是最好的。  这是乐队之战,JMeter风格。 BeanshellV.JSR223V.JavaRequestSampler 在我们之前的帖子中,  JMeterPerformance和TuningTips  ( 由fantastik
Scala和Java为静态语言,Groovy为动态语言Scala:函数式编程,同时支持面向对象Groovy:jvm上的脚本,较好兼容java语法,Groovy加强了Java集成。 可配置化的优势,可以将一些简单的逻辑公开给外部编辑和使用,增强了互操作性,复杂逻辑来说,可配置化代码的调试则会比较麻烦 Scala和Java
出处:https://www.jianshu.com/p/ce6f8a1f66f4一、一些内部元件的访问testRunner.testCase开头1、向下访问testRunner.testCase.testSteps[testStepName]testRunner.testCase.getTestStepByName("新增一个空间")2、向上访问,用于访问同一项目中的其他testSuites和testCase下
在运行groovy的junit方法时,报了这个错误:java.lang.ExceptionInInitializerError atorg.codehaus.groovy.reflection.ClassInfo.isValidWeakMetaClass(ClassInfo.java:271) atorg.codehaus.groovy.reflection.ClassInfo.getMetaClassForClass(ClassInfo.java:241) atorg.codeha
基本语法1.Grovvy的注释分为//和/**/和java的一样.2.Grovvy语法可以不已分号结尾.3.单引号,里面的内容严格的对应java中的String,不对$符号进行转义.defs1='iamastudent$'printlns1iamastudent$4.双引号“”的内容中如果有$号的话,会先对表达式先求值.de
Tiobe发布了最新一期(3月份)编程语言欢迎度榜单,其榜单根据互联网上有经验的程序员、课程和第三方厂商的数量,并使用搜索引擎(如Google、Bing、Yahoo!)以及Wikipedia、Amazon、YouTube统计出排名数据。TOP5几乎没有变化,Java和C语言牢牢占据前两名。Python相较去年上升一位进入TOP3,C++下
我有一个Google地图组件,作者可以在其中指定纬度和经度.我正在使用带有正则表达式的常规“输入”类型控件来验证它们是否是数字,但是,当试图解决指定范围的问题时(经度验证该值在[-180,180]内并且纬度[-90,90])但是,通过正则表达式进行验证似乎很麻烦,而且利用inputtype=“numb
我正在为未来的应用程序评估SpringBoot,并希望使用Groovy模板来实现其纯粹的可读性.不幸的是,我在迭代我添加到控制器返回的ModelAndView对象的对象列表时遇到了麻烦.这是我的控制器:@RestController@RequestMapping("/ships")publicclassShipsController{@Autowired
我有一个基于Spring的java应用程序,其中包含一些有用的组件.作为系统的一部分,我有一个groovy脚本,来处理一些报告.我想从groovy脚本中调用spring组件.当我用Java编写时,我需要在@Component中使用@Autowired注释,即@ComponentclassReporter{@AutowiredSearchServicesearchS
在Grailsi18n插件definedthusly中定义了一个messageSourcebean:messageSource(PluginAwareResourceBundleMessageSource){basenames=baseNames.toArray()fallbackToSystemLocale=falsepluginManager=manager....}是否可以覆盖我的resources.groovy中的fa
我正在寻找一种方法来反向工程RDBMS表(MSSQLServer)并生成JPA@EntityGroovy类.我们目前没有选择使用Grails和/或GORM,因此Grailsdb-reverse-engineer插件似乎很接近但不太正确.它生成符合GORM的类而不是JPA实体类.我们目前有一个gradle构建,它利用org.hibernate.tool.ant.Hibe
https://blog.csdn.net/Gdeer/article/details/83062523一、直接运行groovy程序因为groovy插件和android插件不兼容,所以不能在原始项目上使用groovy。 新建module,创一个JavaLibrary,取名lib。  修改lib/build.gradleapplyplugin:'java-library'depe
一、自动生成GET请求脚本1、配置Createascript在ngrinder管理台主页,点击script–>Createascript,并填写脚本名称和请求的url,如下所示:点击Create按钮,nGrinder会自动生成对应的脚本结构,如果没有参数需要设置的话,可以直接运行了。二、详细解析GET请求脚本ngrinder自动生成的脚本
我正在关注使用列表和地图作为构造函数的this博文.为什么以下列表无法强制反对?classTest{staticclassTestObject{privateinta=1;protectedintb=2;publicintc=3;intd=4;Strings="s";}stati
Information:java:Errorsoccurredwhilecompilingmodule'security'Information:javac1.8.0_131wasusedtocompilejavasourcesInformation:2019/6/98:31-Buildcompletedwith1errorand0warningsin3s116msError:java:读取E:\repository\org
ngrinder中的groovy脚本结构类似junit,同时在junit的基础之上封装了自己的注解,用来控制脚本的运行。一、运行逻辑图如下:此处只列出了groovy脚本的逻辑,jython脚本是类似的,在此不再单独介绍。二、各注解的使用比较三、关注点在ngrinder中,通常使用单进程多线程就足够大部分测试了,所以:
我有一个switch语句来处理javaenumfoo,并使用spock编写一些groovy单元测试.我已经添加了一个测试,它验证当前是否处理了每种类型的foo而没有抛出异常.现在我想测试一个无法识别的foo类型会导致抛出异常.要做到这一点,我将不得不嘲笑枚举,并已经看到这里概述的解决方案:MockingJ
我有一个groovy实体ClientInvoiceAttachmentExt,它扩展了java实体ClientInvoiceAttachment.ClientInvoiceAttachment具有@Id注释,但仍然看到“没有为实体指定的标识符”错误这是我的堆栈跟踪[Mar0317:11:54]ERROR|org.springframework.web.context.ContextLoader|Contex