spring boot application properties配置详解

时间:2024-10-30 19:52:26

# ===================================================================
# COMMON SPRING BOOT PROPERTIES
#
# This sample file is provided as a guideline. Do NOT copy it in its
# entirety to your own application.               ^^^
# ===================================================================

# ----------------------------------------
# CORE PROPERTIES
# ----------------------------------------

# SPRING CONFIG (ConfigFileApplicationListener)
= # config file name (default to 'application')
= # location of config file

# PROFILES
= # comma list of active profiles

# APPLICATION SETTINGS (SpringApplication)
=
-environment= # detect by default
-banner=true
....= # see class for all properties

# LOGGING
=/var/logs
=
=

# IDENTITY (ContextIdApplicationContextInitializer)
=
=

# EMBEDDED SERVER CONFIGURATION (ServerProperties)
=8080
= # bind to a specific NIC
-timeout= # session timeout in seconds
-path= # the context path, defaults to '/'
-path= # the servlet path, defaults to '/'
-log-pattern= # log pattern of the access log
-log-enabled=false # is access logging enabled
-header=x-forwarded-proto # ssl forward headers
-ip-header=x-forwarded-for
=/tmp # base dir (usually not needed, defaults to tmp)
-processor-delay=30; # in seconds
-threads = 0 # number of threads in protocol handler
-encoding = UTF-8 # character encoding to use for URL decoding

# SPRING MVC (HttpMapperProperties)
-pretty-print=false # pretty print JSON
-sort-keys=false # sort keys
= # set fixed locale, . en_UK
-format= # set fixed date format, . dd/MM/yyyy
-codes-resolver-format= # PREFIX_ERROR_CODE / POSTFIX_ERROR_CODE
= # MVC view prefix
= # ... and suffix
-period= # cache timeouts in headers sent to browser
-mappings=true # if default mappings should be added

# THYMELEAF (ThymeleafAutoConfiguration)
=classpath:/templates/
=.html
=HTML5
=UTF-8
-type=text/html # ;charset=<encoding> is added
=true # set to false for hot refresh

# FREEMARKER (FreeMarkerAutoConfiguration)
=false
=false
=true
=true
=text/html
=false
=false
=false
=
=
.*=
=.ftl
=UTF-8
=classpath:/templates/
= # whitelist of view names that can be resolved

# GROOVY TEMPLATES (GroovyTemplateAutoConfiguration)
=false
=false
=true
.*= # See Groovy's TemplateConfiguration
=text/html
=classpath:/templates/
=.tpl
=UTF-8
= # whitelist of view names that can be resolved

# VELOCITY TEMPLATES (VelocityAutoConfiguration)
=false
=false
=true
=true
=text/html
=
=false
=false
=false
=
=
.*=
=
=classpath:/templates/
=.vm
=UTF-8
= # whitelist of view names that can be resolved

# INTERNATIONALIZATION (MessageSourceAutoConfiguration)
=messages
=-1
=UTF-8


# SECURITY (SecurityProperties)
=user # login username
= # login password
=USER # role assigned to the user
-ssl=false # advanced settings ...
-csrf=false
=true
=Spring
= # /**
=false
=false
=false
=false
=all # none / domain / all
=stateless # always / never / if_required / stateless
=false

# DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
= # name of the data source
=true # populate using 
= # a schema (DDL) script resource reference
= # a data (DML) script resource reference
= # the platform to use in the schema resource (schema-${platform}.sql)
=false # continue even if can't be initialized
=; # statement separator in SQL initialization scripts
= # JDBC Settings...
=
=
=
-active=100 # Advanced configuration...
-idle=8
-idle=8
-size=10
-query=
-on-borrow=false
-on-return=false
-while-idle=
-between-eviction-runs-millis=
-evictable-idle-time-millis=
-wait-millis=

# MONGODB (MongoProperties)
= # the db host
=27017 # the connection port (defaults to 27107)
=mongodb://localhost/test # connection URL
=true # if spring data repository support is enabled

# JPA (JpaBaseConfiguration, HibernateJpaAutoConfiguration)
.*= # properties to set on the JPA connection
=true
-sql=true
-platform=
=
-ddl=false # ignored by Hibernate, might be useful for other vendors
-strategy= # naming classname
-auto= # defaults to create-drop for embedded dbs
=true # if spring data repository support is enabled

# SOLR (SolrProperties})
=http://127.0.0.1:8983/solr
=
=true # if spring data repository support is enabled

# ELASTICSEARCH (ElasticsearchProperties})
-name= # The cluster name (defaults to elasticsearch)
-nodes= # The address(es) of the server node (comma-separated; if not specified starts a client node)
=true # if local mode should be used with client nodes
=true # if spring data repository support is enabled



# FLYWAY (FlywayProperties)
=classpath:db/migrations # locations of migrations scripts
= # schemas to update
= 1 # version to start migration
=V
=.sql
=true
= # JDBC url if you want Flyway to create its own DataSource
= # JDBC username if you want Flyway to create its own DataSource
= # JDBC password if you want Flyway to create its own DataSource

# LIQUIBASE (LiquibaseProperties)
-log=classpath:/db/changelog/
= # runtime contexts to use
-schema= # default database schema to use
-first=false
=true

# JMX
=true # Expose MBeans from Spring

# RABBIT (RabbitProperties)
= # connection host
= # connection port
= # connection addresses (. myhost:9999,otherhost:1111)
= # login user
= # login password
=
=

# REDIS (RedisProperties)
=localhost # server host
= # server password
=6379 # connection port
-idle=8 # pool settings ...
-idle=0
-active=8
-wait=-1

# ACTIVEMQ (ActiveMQProperties)
-url=tcp://localhost:61616 # connection URL
=
=
-memory=true # broker kind to create if no broker-url is specified
=false

# HornetQ (HornetQProperties)
= # connection mode (native, embedded)
=localhost # hornetQ host (native mode)
=5445 # hornetQ port (native mode)
=true # if the embedded server is enabled (needs )
= # auto-generated id of the embedded server (integer)
=false # message persistence
-directory= # location of data content (when persistence is enabled)
= # comma separate queues to create on startup
= # comma separate topics to create on startup
-password= # customer password (randomly generated by default)

# JMS (JmsProperties)
-sub-domain= # false for queue (default), true for topic

# SPRING BATCH (BatchDatabaseInitializer)
=job1,job2
=true
=true
= # batch schema to load

# AOP
=
-target-class=

# FILE ENCODING (FileEncodingApplicationListener)
-file-encoding=false

# SPRING SOCIAL (SocialWebAutoConfiguration)
-connection-views=true # Set to true for default connection views or false if you provide your own

# SPRING SOCIAL FACEBOOK (FacebookAutoConfiguration)
-id= # your application's Facebook App ID
-secret= # your application's Facebook App Secret

# SPRING SOCIAL LINKEDIN (LinkedInAutoConfiguration)
-id= # your application's LinkedIn App ID
-secret= # your application's LinkedIn App Secret

# SPRING SOCIAL TWITTER (TwitterAutoConfiguration)
-id= # your application's Twitter App ID
-secret= # your application's Twitter App Secret

# SPRING MOBILE SITE PREFERENCE (SitePreferenceAutoConfiguration)
=true # enabled by default

# SPRING MOBILE DEVICE VIEWS (DeviceDelegatingViewResolverAutoConfiguration)
=true # disabled by default
=
=
=mobile/
=
=tablet/
=

# ----------------------------------------
# ACTUATOR PROPERTIES
# ----------------------------------------

# MANAGEMENT HTTP SERVER (ManagementServerProperties)
= # defaults to ''
= # bind to a specific NIC
= # default to '/'

# ENDPOINTS (AbstractEndpoint subclasses)
=autoconfig
=true
=true
=beans
=true
=true
=configprops
=true
=true
-to-sanitize=password,secret
=dump
=true
=true
=env
=true
=true
=health
=false
=true
=info
=false
=true
=metrics
=true
=true
=shutdown
=true
=false
=trace
=true
=true

# MVC ONLY ENDPOINTS
=jolokia
=true
=true # when using Jolokia
=/error

# JMX ENDPOINT (EndpointMBeanExportProperties)
=true
= # the JMX domain, defaults to ''
-names=false
=true
=

# JOLOKIA (JolokiaProperties)
.*= # See Jolokia manual

# REMOTE SHELL
=simple # jaas, key, simple, spring
-refresh-interval=-1
-path-pattern= # classpath*:/commands/**, classpath*:/crash/commands/**
-path-patterns= # classpath*:/crash/*
-plugins=false # don't expose plugins
= # ssh settings ...
=
=
= # telnet settings ...
=
= # authentication settings ...
=
=
=
=

# GIT INFO
= # resource ref to generated git info properties file

# SPRING CONFIG (ConfigFileApplicationListener)