javascript
Spring Boot application.properties 常用配置
SPRING CONFIG (ConfigFileApplicationListener)
spring.config.name配置文件名稱,默認為application
spring.config.location配置文件存放位置,默認為classpath目錄下
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的模板支持.
指定模板的前綴,默認: 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)
指定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.
PROFILES
spring.profiles.active= # comma list of active profiles spring.profiles.include= # unconditionally activate the specified comma separated profilesAPPLICATION SETTINGS (SpringApplication)
spring.main.sources= spring.main.web-environment= # detect by default spring.main.show-banner=true spring.main....= # see class for all propertiesLOGGING
logging.path=/var/logs logging.file=myapp.log logging.config= # location of config file (default classpath:logback.xml for logback) logging.level.*= # levels for loggers, e.g. "logging.level.org.springframework=DEBUG" (TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF)IDENTITY (ContextIdApplicationContextInitializer)
spring.application.name= spring.application.index=EMBEDDED SERVER CONFIGURATION (ServerProperties)
server.port=8080 server.address= # bind to a specific NIC server.session-timeout= # session timeout in seconds server.context-parameters.*= # Servlet context init parameters, e.g. server.context-parameters.a=alpha server.context-path= # the context path, defaults to '/' server.servlet-path= # the servlet path, defaults to '/' server.ssl.enabled=true # if SSL support is enabled server.ssl.client-auth= # want or need server.ssl.key-alias= server.ssl.ciphers= # supported SSL ciphers server.ssl.key-password= server.ssl.key-store= server.ssl.key-store-password= server.ssl.key-store-provider= server.ssl.key-store-type= server.ssl.protocol=TLS server.ssl.trust-store= server.ssl.trust-store-password= server.ssl.trust-store-provider= server.ssl.trust-store-type= server.tomcat.access-log-pattern= # log pattern of the access log server.tomcat.access-log-enabled=false # is access logging enabled server.tomcat.internal-proxies=10\.\d{1,3}\.\d{1,3}\.\d{1,3}|\ 192\.168\.\d{1,3}\.\d{1,3}|\ 169\.254\.\d{1,3}\.\d{1,3}|\ 127\.\d{1,3}\.\d{1,3}\.\d{1,3} # regular expression matching trusted IP addresses server.tomcat.protocol-header=x-forwarded-proto # front end proxy forward header server.tomcat.port-header= # front end proxy port header server.tomcat.remote-ip-header=x-forwarded-for server.tomcat.basedir=/tmp # base dir (usually not needed, defaults to tmp) server.tomcat.background-processor-delay=30; # in seconds server.tomcat.max-http-header-size= # maximum size in bytes of the HTTP message header server.tomcat.max-threads = 0 # number of threads in protocol handler server.tomcat.uri-encoding = UTF-8 # character encoding to use for URL decodingSPRING MVC (WebMvcProperties)
spring.mvc.locale= # set fixed locale, e.g. en_UK spring.mvc.date-format= # set fixed date format, e.g. dd/MM/yyyy spring.mvc.message-codes-resolver-format= # PREFIX_ERROR_CODE / POSTFIX_ERROR_CODE spring.mvc.ignore-default-model-on-redirect=true # If the the content of the "default" model should be ignored redirects spring.view.prefix= # MVC view prefix spring.view.suffix= # ... and suffix spring.resources.cache-period= # cache timeouts in headers sent to browser spring.resources.add-mappings=true # if default mappings should be addedSPRING HATEOS (HateoasProperties)
spring.hateoas.apply-to-primary-object-mapper=true # if the primary mapper should also be configuredHTTP encoding (HttpEncodingProperties)
spring.http.encoding.charset=UTF-8 # the encoding of HTTP requests/responses spring.http.encoding.enabled=true # enable http encoding support spring.http.encoding.force=true # force the configured encodingJACKSON (JacksonProperties)
spring.jackson.date-format= # Date format string (e.g. yyyy-MM-dd HH:mm:ss), or a fully-qualified date format class name (e.g. com.fasterxml.jackson.databind.util.ISO8601DateFormat) spring.jackson.property-naming-strategy= # One of the constants on Jackson's PropertyNamingStrategy (e.g. CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES) or the fully-qualified class name of a PropertyNamingStrategy subclass spring.jackson.deserialization.= # see Jackson's DeserializationFeature spring.jackson.generator.= # see Jackson's JsonGenerator.Feature spring.jackson.mapper.= # see Jackson's MapperFeature spring.jackson.parser.= # see Jackson's JsonParser.Feature spring.jackson.serialization.*= # see Jackson's SerializationFeatureTHYMELEAF (ThymeleafAutoConfiguration)
spring.thymeleaf.check-template-location=true spring.thymeleaf.prefix=classpath:/templates/ spring.thymeleaf.excluded-view-names= # comma-separated list of view names that should be excluded from resolution spring.thymeleaf.view-names= # comma-separated list of view names that can be resolved spring.thymeleaf.suffix=.html spring.thymeleaf.mode=HTML5 spring.thymeleaf.encoding=UTF-8 spring.thymeleaf.content-type=text/html # ;charset=<encoding> is added spring.thymeleaf.cache=true # set to false for hot refreshREEMARKER (FreeMarkerAutoConfiguration)
spring.freemarker.allow-request-override=false spring.freemarker.cache=true spring.freemarker.check-template-location=true spring.freemarker.charset=UTF-8 spring.freemarker.content-type=text/html spring.freemarker.expose-request-attributes=false spring.freemarker.expose-session-attributes=false spring.freemarker.expose-spring-macro-helpers=false spring.freemarker.prefix= spring.freemarker.request-context-attribute= spring.freemarker.settings.*= spring.freemarker.suffix=.ftl spring.freemarker.template-loader-path=classpath:/templates/ # comma-separated list spring.freemarker.view-names= # whitelist of view names that can be resolvedGROOVY TEMPLATES (GroovyTemplateAutoConfiguration)
spring.groovy.template.cache=true spring.groovy.template.charset=UTF-8 spring.groovy.template.configuration.*= # See Groovy's TemplateConfiguration spring.groovy.template.content-type=text/html spring.groovy.template.prefix=classpath:/templates/ spring.groovy.template.suffix=.tpl spring.groovy.template.view-names= # whitelist of view names that can be resolvedVELOCITY TEMPLATES (VelocityAutoConfiguration)
spring.velocity.allow-request-override=false spring.velocity.cache=true spring.velocity.check-template-location=true spring.velocity.charset=UTF-8 spring.velocity.content-type=text/html spring.velocity.date-tool-attribute= spring.velocity.expose-request-attributes=false spring.velocity.expose-session-attributes=false spring.velocity.expose-spring-macro-helpers=false spring.velocity.number-tool-attribute= spring.velocity.prefer-file-system-access=true # prefer file system access for template loading spring.velocity.prefix= spring.velocity.properties.*= spring.velocity.request-context-attribute= spring.velocity.resource-loader-path=classpath:/templates/ spring.velocity.suffix=.vm spring.velocity.toolbox-config-location= # velocity Toolbox config location, for example "/WEB-INF/toolbox.xml" spring.velocity.view-names= # whitelist of view names that can be resolvedJERSEY (JerseyProperties)
spring.jersey.type=servlet # servlet or filter spring.jersey.init= # init params spring.jersey.filter.order=INTERNATIONALIZATION (MessageSourceAutoConfiguration)
spring.messages.basename=messages spring.messages.cache-seconds=-1 spring.messages.encoding=UTF-8SECURITY (SecurityProperties)
security.user.name=user # login username security.user.password= # login password security.user.role=USER # role assigned to the user security.require-ssl=false # advanced settings ... security.enable-csrf=false security.basic.enabled=true security.basic.realm=Spring security.basic.path= # /** security.filter-order=0 security.headers.xss=false security.headers.cache=false security.headers.frame=false security.headers.content-type=false security.headers.hsts=all # none / domain / all security.sessions=stateless # always / never / if_required / stateless security.ignored=falseDATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
spring.datasource.name= # name of the data source spring.datasource.initialize=true # populate using data.sql spring.datasource.schema= # a schema (DDL) script resource reference spring.datasource.data= # a data (DML) script resource reference spring.datasource.sql-script-encoding= # a charset for reading SQL scripts spring.datasource.platform= # the platform to use in the schema resource (schema-${platform}.sql) spring.datasource.continue-on-error=false # continue even if can't be initialized spring.datasource.separator=; # statement separator in SQL initialization scripts spring.datasource.driver-class-name= # JDBC Settings... spring.datasource.url= spring.datasource.username= spring.datasource.password= spring.datasource.jndi-name= # For JNDI lookup (class, url, username & password are ignored when set) spring.datasource.max-active=100 # Advanced configuration... spring.datasource.max-idle=8 spring.datasource.min-idle=8 spring.datasource.initial-size=10 spring.datasource.validation-query= spring.datasource.test-on-borrow=false spring.datasource.test-on-return=false spring.datasource.test-while-idle= spring.datasource.time-between-eviction-runs-millis= spring.datasource.min-evictable-idle-time-millis= spring.datasource.max-wait= spring.datasource.jmx-enabled=false # Export JMX MBeans (if supported) spring.dao.exceptiontranslation.enabled 是否開啟PersistenceExceptionTranslationPostProcessor,默認為true spring.datasource.abandon-when-percentage-full 設定超時被廢棄的連接占到多少比例時要被關閉或上報 spring.datasource.allow-pool-suspension 使用Hikari pool時,是否允許連接池暫停,默認為: false spring.datasource.alternate-username-allowed 是否允許替代的用戶名. spring.datasource.auto-commit 指定updates是否自動提交. spring.datasource.catalog 指定默認的catalog. spring.datasource.commit-on-return 設置當連接被歸還時,是否要提交所有還未完成的事務 spring.datasource.connection-init-sql 指定連接被創建,再被添加到連接池之前執行的sql. spring.datasource.connection-init-sqls 使用DBCP connection pool時,指定初始化時要執行的sql spring.datasource.connection-properties.[key] 在使用DBCP connection pool時指定要配置的屬性 spring.datasource.connection-test-query 指定校驗連接合法性執行的sql語句 spring.datasource.connection-timeout 指定連接的超時時間,毫秒單位. spring.datasource.continue-on-error 在初始化數據庫時,遇到錯誤是否繼續,默認false spring.datasource.data 指定Data (DML)腳本 spring.datasource.data-source-class-name 指定數據源的全限定名. spring.datasource.data-source-jndi 指定jndi的地址 spring.datasource.data-source-properties.[key] 使用Hikari connection pool時,指定要設置的屬性 spring.datasource.db-properties 使用Tomcat connection pool,指定要設置的屬性 spring.datasource.default-auto-commit 是否自動提交. spring.datasource.default-catalog 指定連接默認的catalog. spring.datasource.default-read-only 是否設置默認連接只讀. spring.datasource.default-transaction-isolation 指定連接的事務的默認隔離級別. spring.datasource.driver-class-name 指定driver的類名,默認從jdbc url中自動探測. spring.datasource.fair-queue 是否采用FIFO返回連接. spring.datasource.health-check-properties.[key] 使用Hikari connection pool時,在心跳檢查時傳遞的屬性 spring.datasource.idle-timeout 指定連接多久沒被使用時,被設置為空閑,默認為10ms spring.datasource.ignore-exception-on-pre-load 當初始化連接池時,是否忽略異常. spring.datasource.init-sql 當連接創建時,執行的sql spring.datasource.initial-size 指定啟動連接池時,初始建立的連接數量 spring.datasource.initialization-fail-fast 當創建連接池時,沒法創建指定最小連接數量是否拋異常 spring.datasource.initialize 指定初始化數據源,是否用data.sql來初始化,默認: true spring.datasource.isolate-internal-queries 指定內部查詢是否要被隔離,默認為false spring.datasource.jdbc-interceptors 使用Tomcat connection pool時,指定jdbc攔截器,分號分隔 spring.datasource.jdbc-url 指定JDBC URL. spring.datasource.jmx-enabled 是否開啟JMX,默認為: false spring.datasource.jndi-name 指定jndi的名稱. spring.datasource.leak-detection-threshold 使用Hikari connection pool時,多少毫秒檢測一次連接泄露. spring.datasource.log-abandoned 使用DBCP connection pool,是否追蹤廢棄statement或連接,默認為: false spring.datasource.log-validation-errors 當使用Tomcat connection pool是否打印校驗錯誤. spring.datasource.login-timeout 指定連接數據庫的超時時間. spring.datasource.max-active 指定連接池中最大的活躍連接數. spring.datasource.max-age 指定連接池中連接的最大年齡 spring.datasource.max-idle 指定連接池最大的空閑連接數量. spring.datasource.max-lifetime 指定連接池中連接的最大生存時間,毫秒單位. spring.datasource.max-open-prepared-statements 指定最大的打開的prepared statements數量. spring.datasource.max-wait 指定連接池等待連接返回的最大等待時間,毫秒單位. spring.datasource.maximum-pool-size 指定連接池最大的連接數,包括使用中的和空閑的連接. spring.datasource.min-evictable-idle-time-millis 指定一個空閑連接最少空閑多久后可被清除. spring.datasource.min-idle 指定必須保持連接的最小值(For DBCP and Tomcat connection pools) spring.datasource.minimum-idle 指定連接維護的最小空閑連接數,當使用HikariCP時指定. spring.datasource.name 指定數據源名. spring.datasource.num-tests-per-eviction-run 指定運行每個idle object evictor線程時的對象數量 spring.datasource.password 指定數據庫密碼. spring.datasource.platform 指定schema要使用的Platform(schema-${platform}.sql),默認為: all spring.datasource.pool-name 指定連接池名字. spring.datasource.pool-prepared-statements 指定是否池化statements. spring.datasource.propagate-interrupt-state 在等待連接時,如果線程被中斷,是否傳播中斷狀態. spring.datasource.read-only 當使用Hikari connection pool時,是否標記數據源只讀 spring.datasource.register-mbeans 指定Hikari connection pool是否注冊JMX MBeans. spring.datasource.remove-abandoned 指定當連接超過廢棄超時時間時,是否立刻刪除該連接. spring.datasource.remove-abandoned-timeout 指定連接應該被廢棄的時間. spring.datasource.rollback-on-return 在歸還連接時,是否回滾等待中的事務. spring.datasource.schema 指定Schema (DDL)腳本. spring.datasource.separator 指定初始化腳本的語句分隔符,默認: ; spring.datasource.sql-script-encoding 指定SQL scripts編碼. spring.datasource.suspect-timeout 指定打印廢棄連接前的超時時間. spring.datasource.test-on-borrow 當從連接池借用連接時,是否測試該連接. spring.datasource.test-on-connect 創建時,是否測試連接 spring.datasource.test-on-return 在連接歸還到連接池時是否測試該連接. spring.datasource.test-while-idle 當連接空閑時,是否執行連接測試. spring.datasource.time-between-eviction-runs-millis 指定空閑連接檢查、廢棄連接清理、空閑連接池大小調整之間的操作時間間隔 spring.datasource.transaction-isolation 指定事務隔離級別,使用Hikari connection pool時指定 spring.datasource.url 指定JDBC URL. spring.datasource.use-disposable-connection-facade 是否對連接進行包裝,防止連接關閉之后被使用. spring.datasource.use-equals 比較方法名時是否使用String.equals()替換==. spring.datasource.use-lock 是否對連接操作加鎖 spring.datasource.username 指定數據庫名. spring.datasource.validation-interval 指定多少ms執行一次連接校驗. spring.datasource.validation-query 指定獲取連接時連接校驗的sql查詢語句. spring.datasource.validation-query-timeout 指定連接校驗查詢的超時時間. spring.datasource.validation-timeout 設定連接校驗的超時時間,當使用Hikari connection pool時指定 spring.datasource.validator-class-name 用來測試查詢的validator全限定名. spring.datasource.xa.data-source-class-name 指定數據源的全限定名. spring.datasource.xa.properties 指定傳遞給XA data source的屬性DATASOURCE (PersistenceExceptionTranslationAutoConfiguration
spring.dao.exceptiontranslation.enabled=trueMONGODB (MongoProperties)
spring.data.mongodb.host= # the db host spring.data.mongodb.port=27017 # the connection port (defaults to 27107) spring.data.mongodb.uri=mongodb://localhost/test # connection URL spring.data.mongodb.database= spring.data.mongodb.authentication-database= spring.data.mongodb.grid-fs-database= spring.data.mongodb.username= spring.data.mongodb.password= spring.data.mongodb.repositories.enabled=true # if spring data repository support is enabledJPA (JpaBaseConfiguration, HibernateJpaAutoConfiguration)
spring.jpa.properties.*= # properties to set on the JPA connection spring.jpa.open-in-view=true spring.jpa.show-sql=true spring.jpa.database-platform= spring.jpa.database= spring.jpa.generate-ddl=false # ignored by Hibernate, might be useful for other vendors spring.jpa.hibernate.naming-strategy= # naming classname spring.jpa.hibernate.ddl-auto= # defaults to create-drop for embedded dbs spring.data.jpa.repositories.enabled=true # if spring data repository support is enabledJTA (JtaAutoConfiguration)
spring.jta.log-dir= # transaction log dir spring.jta.*= # technology specific configurationSOLR (SolrProperties})
spring.data.solr.host=http://127.0.0.1:8983/solr spring.data.solr.zk-host= spring.data.solr.repositories.enabled=true # if spring data repository support is enabledELASTICSEARCH (ElasticsearchProperties})
spring.data.elasticsearch.cluster-name= # The cluster name (defaults to elasticsearch) spring.data.elasticsearch.cluster-nodes= # The address(es) of the server node (comma-separated; if not specified starts a client node) spring.data.elasticsearch.repositories.enabled=true # if spring data repository support is enabledDATA RESET (RepositoryRestConfiguration})
spring.data.rest.base-uri= # base URI against which the exporter should calculate its linksFLYWAY (FlywayProperties)
flyway.check-location=false # check that migration scripts location exists flyway.locations=classpath:db/migration # locations of migrations scripts flyway.schemas= # schemas to update flyway.init-version= 1 # version to start migration flyway.init-sqls= # SQL statements to execute to initialize a connection immediately after obtaining it flyway.sql-migration-prefix=V flyway.sql-migration-suffix=.sql flyway.enabled=true flyway.url= # JDBC url if you want Flyway to create its own DataSource flyway.user= # JDBC username if you want Flyway to create its own DataSource flyway.password= # JDBC password if you want Flyway to create its own DataSourceLIQUIBASE (LiquibaseProperties)
liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml liquibase.check-change-log-location=true # check the change log location exists liquibase.contexts= # runtime contexts to use liquibase.default-schema= # default database schema to use liquibase.drop-first=false liquibase.enabled=true liquibase.url= # specific JDBC url (if not set the default datasource is used) liquibase.user= # user name for liquibase.url liquibase.password= # password for liquibase.urlJMX
spring.jmx.enabled=true # Expose MBeans from SpringRABBIT (RabbitProperties)
spring.rabbitmq.host= # connection host spring.rabbitmq.port= # connection port spring.rabbitmq.addresses= # connection addresses (e.g. myhost:9999,otherhost:1111) spring.rabbitmq.username= # login user spring.rabbitmq.password= # login password spring.rabbitmq.virtual-host= spring.rabbitmq.dynamic=REDIS (RedisProperties)
spring.redis.database= # database name spring.redis.host=localhost # server host spring.redis.password= # server password spring.redis.port=6379 # connection port spring.redis.pool.max-idle=8 # pool settings ... spring.redis.pool.min-idle=0 spring.redis.pool.max-active=8 spring.redis.pool.max-wait=-1 spring.redis.sentinel.master= # name of Redis server spring.redis.sentinel.nodes= # comma-separated list of host:port pairs Redis數據庫索引(默認為0)**spring.redis.database=0 ** Redis服務器地址 spring.redis.host=192.168.0.58 Redis服務器連接端口 **spring.redis.port=6379 ** Redis服務器連接密碼(默認為空) **spring.redis.password= ** 連接池最大連接數(使用負值表示沒有限制) **spring.redis.pool.max-active=8 ** 連接池最大阻塞等待時間(使用負值表示沒有限制) **spring.redis.pool.max-wait=-1 ** 連接池中的最大空閑連接 **spring.redis.pool.max-idle=8 ** 連接池中的最小空閑連接 **spring.redis.pool.min-idle=0 ** 連接超時時間(毫秒) **spring.redis.timeout=0 **ACTIVEMQ (ActiveMQProperties)
spring.activemq.broker-url=tcp://localhost:61616 # connection URL spring.activemq.user= spring.activemq.password= spring.activemq.in-memory=true # broker kind to create if no broker-url is specified spring.activemq.pooled=falseHornetQ (HornetQProperties)
spring.hornetq.mode= # connection mode (native, embedded) spring.hornetq.host=localhost # hornetQ host (native mode) spring.hornetq.port=5445 # hornetQ port (native mode) spring.hornetq.embedded.enabled=true # if the embedded server is enabled (needs hornetq-jms-server.jar) spring.hornetq.embedded.server-id= # auto-generated id of the embedded server (integer) spring.hornetq.embedded.persistent=false # message persistence spring.hornetq.embedded.data-directory= # location of data content (when persistence is enabled) spring.hornetq.embedded.queues= # comma-separated queues to create on startup spring.hornetq.embedded.topics= # comma-separated topics to create on startup spring.hornetq.embedded.cluster-password= # customer password (randomly generated by default)JMS (JmsProperties)
spring.jms.jndi-name= # JNDI location of a JMS ConnectionFactory spring.jms.pub-sub-domain= # false for queue (default), true for topicEmail (MailProperties)
spring.mail.host=smtp.acme.org # mail server host spring.mail.port= # mail server port spring.mail.username= spring.mail.password= spring.mail.default-encoding=UTF-8 # encoding to use for MimeMessages spring.mail.properties.*= # properties to set on the JavaMail sessionSPRING BATCH (BatchDatabaseInitializer)
spring.batch.job.names=job1,job2 spring.batch.job.enabled=true spring.batch.initializer.enabled=true spring.batch.schema= # batch schema to loadAOP
spring.aop.auto= spring.aop.proxy-target-class=FILE ENCODING (FileEncodingApplicationListener)
spring.mandatory-file-encoding=falseSPRING SOCIAL (SocialWebAutoConfiguration)
spring.social.auto-connection-views=true # Set to true for default connection views or false if you provide your ownSPRING SOCIAL FACEBOOK (FacebookAutoConfiguration)
spring.social.facebook.app-id= # your application's Facebook App ID spring.social.facebook.app-secret= # your application's Facebook App SecretSPRING SOCIAL LINKEDIN (LinkedInAutoConfiguration)
spring.social.linkedin.app-id= # your application's LinkedIn App ID spring.social.linkedin.app-secret= # your application's LinkedIn App SecretSPRING SOCIAL TWITTER (TwitterAutoConfiguration)
spring.social.twitter.app-id= # your application's Twitter App ID spring.social.twitter.app-secret= # your application's Twitter App SecretSPRING MOBILE SITE PREFERENCE (SitePreferenceAutoConfiguration)
spring.mobile.sitepreference.enabled=true # enabled by defaultSPRING MOBILE DEVICE VIEWS (DeviceDelegatingViewResolverAutoConfiguration)
spring.mobile.devicedelegatingviewresolver.enabled=true # disabled by default spring.mobile.devicedelegatingviewresolver.normal-prefix= spring.mobile.devicedelegatingviewresolver.normal-suffix= spring.mobile.devicedelegatingviewresolver.mobile-prefix=mobile/ spring.mobile.devicedelegatingviewresolver.mobile-suffix= spring.mobile.devicedelegatingviewresolver.tablet-prefix=tablet/ spring.mobile.devicedelegatingviewresolver.tablet-suffix=MANAGEMENT HTTP SERVER (ManagementServerProperties)
management.port= # defaults to 'server.port' management.address= # bind to a specific NIC management.context-path= # default to '/' management.add-application-context-header= # default to true management.security.enabled=true # enable security management.security.role=ADMIN # role required to access the management endpoint management.security.sessions=stateless # session creating policy to use (always, never, if_required, stateless)PID FILE (ApplicationPidFileWriter)
spring.pidfile= # Location of the PID file to writeENDPOINTS (AbstractEndpoint subclasses)
endpoints.autoconfig.id=autoconfig endpoints.autoconfig.sensitive=true endpoints.autoconfig.enabled=true endpoints.beans.id=beans endpoints.beans.sensitive=true endpoints.beans.enabled=true endpoints.configprops.id=configprops endpoints.configprops.sensitive=true endpoints.configprops.enabled=true endpoints.configprops.keys-to-sanitize=password,secret,key # suffix or regex endpoints.dump.id=dump endpoints.dump.sensitive=true endpoints.dump.enabled=true endpoints.env.id=env endpoints.env.sensitive=true endpoints.env.enabled=true endpoints.env.keys-to-sanitize=password,secret,key # suffix or regex endpoints.health.id=health endpoints.health.sensitive=true endpoints.health.enabled=true endpoints.health.mapping.*= # mapping of health statuses to HttpStatus codes endpoints.health.time-to-live=1000 endpoints.info.id=info endpoints.info.sensitive=false endpoints.info.enabled=true endpoints.mappings.enabled=true endpoints.mappings.id=mappings endpoints.mappings.sensitive=true endpoints.metrics.id=metrics endpoints.metrics.sensitive=true endpoints.metrics.enabled=true endpoints.shutdown.id=shutdown endpoints.shutdown.sensitive=true endpoints.shutdown.enabled=false endpoints.trace.id=trace endpoints.trace.sensitive=true endpoints.trace.enabled=trueHEALTH INDICATORS (previously health.*)
management.health.db.enabled=true management.health.diskspace.enabled=true management.health.mongo.enabled=true management.health.rabbit.enabled=true management.health.redis.enabled=true management.health.solr.enabled=true management.health.diskspace.path=. management.health.diskspace.threshold=10485760 management.health.status.order=DOWN, OUT_OF_SERVICE, UNKNOWN, UPMVC ONLY ENDPOINTS
endpoints.jolokia.path=jolokia endpoints.jolokia.sensitive=true endpoints.jolokia.enabled=true # when using JolokiaJMX ENDPOINT (EndpointMBeanExportProperties)
endpoints.jmx.enabled=true endpoints.jmx.domain= # the JMX domain, defaults to 'org.springboot' endpoints.jmx.unique-names=false endpoints.jmx.static-names=JOLOKIA (JolokiaProperties)
jolokia.config.*= # See Jolokia manualREMOTE SHELL
shell.auth=simple # jaas, key, simple, spring shell.command-refresh-interval=-1 shell.command-path-patterns= # classpath:/commands/, classpath:/crash/commands/** shell.config-path-patterns= # classpath:/crash/ shell.disabled-commands=jpa,jdbc,jndi* # comma-separated list of commands to disable shell.disabled-plugins=false # don't expose plugins shell.ssh.enabled= # ssh settings ... shell.ssh.key-path= shell.ssh.port= shell.telnet.enabled= # telnet settings ... shell.telnet.port= shell.auth.jaas.domain= # authentication settings ... shell.auth.key.path= shell.auth.simple.user.name= shell.auth.simple.user.password= shell.auth.spring.roles=GIT INFO
spring.git.properties= # resource ref to generated git info properties file解決SpringBoot連接池TOMCAT-JDBC(默認) DBCP或C3P0連接超時異常問題
配置數據源連接池的時候如果沒有配置連接檢查或者超時回收,造成之后應用通過連接池getConnection時,都可能獲取到這些不可用的連接。druid沒有上述問題,因為默認有缺省值。
隔多少時間回收廢棄連接 一般比minEvictableIdleTimeMillis小
`spring.datasource.time-between-eviction-`runs-millis=300000指定運行每個eviction線程時的對象數量
spring.datasource.num-tests-per-eviction-run=3指定一個空閑連接最少空閑多久后可被清除.
spring.datasource.min-evictable-idle-time-millis=3600000上面的配置是配置數據源回收連接,只要配置的回收時間小于mysql的超時時間就可以。
spring.datasource.testOnBorrow=true spring.datasource.validationQuery=SELECT 1TestOnBorrow檢測池里連接的可用性,假如連接池中的連接被數據庫關閉了,應用通過連接池getConnection時會重新創建。validationQuery是檢查時用的sql語句
SpringBoot1.4.1 需要分別單獨配置連接池的配置
比如使用hikari連接池
如果感覺不錯的話請點贊喲!!!
總結
以上是生活随笔為你收集整理的Spring Boot application.properties 常用配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C++ multiset
- 下一篇: C 画图