附录A. Spring Boot应用启动器

spring Boot应用启动器基本的一共有44种,具体如下:
1)spring-boot-starter
这是Spring Boot的核心启动器,包含了自动配置、日志和YAML。
2)spring-boot-starter-actuator
帮助监控和管理应用。
3)spring-boot-starter-amqp
通过spring-rabbit来支持AMQP协议(Advanced Message Queuing Protocol)。
4)spring-boot-starter-aop
支持面向方面的编程即AOP,包括spring-aop和AspectJ。
5)spring-boot-starter-artemis
通过Apache Artemis支持JMS的API(Java Message Service API)。
6)spring-boot-starter-batch
支持Spring Batch,包括HSQLDB数据库。
7)spring-boot-starter-cache
支持Spring的Cache抽象。
8)spring-boot-starter-cloud-connectors
支持Spring Cloud Connectors,简化了在像Cloud Foundry或Heroku这样的云平台上连接服务。
9)spring-boot-starter-data-elasticsearch
支持ElasticSearch搜索和分析引擎,包括spring-data-elasticsearch。
10)spring-boot-starter-data-gemfire
支持GemFire分布式数据存储,包括spring-data-gemfire。
11)spring-boot-starter-data-jpa
支持JPA(Java Persistence API),包括spring-data-jpa、spring-orm、hibernate。
12)spring-boot-starter-data-MongoDB
支持MongoDB数据,包括spring-data-mongodb。
13)spring-boot-starter-data-rest
通过spring-data-rest-webmvc,支持通过REST暴露Spring Data数据仓库。
14)spring-boot-starter-data-solr
支持Apache Solr搜索平台,包括spring-data-solr。
15)spring-boot-starter-freemarker
支持FreeMarker模板引擎。
16)spring-boot-starter-groovy-templates
支持Groovy模板引擎。
17)spring-boot-starter-hateoas
通过spring-hateoas支持基于HATEOAS的RESTful Web服务。
18)spring-boot-starter-hornetq
通过HornetQ支持JMS。
19)spring-boot-starter-integration
支持通用的spring-integration模块。
20)spring-boot-starter-jdbc
支持JDBC数据库。
21)spring-boot-starter-jersey
支持Jersey RESTful Web服务框架。
22)spring-boot-starter-jta-atomikos
通过Atomikos支持JTA分布式事务处理。
23)spring-boot-starter-jta-bitronix
通过Bitronix支持JTA分布式事务处理。
24)spring-boot-starter-mail
支持javax.mail模块。
25)spring-boot-starter-mobile
支持spring-mobile。
26)spring-boot-starter-mustache
支持Mustache模板引擎。
27)spring-boot-starter-Redis
支持Redis键值存储数据库,包括spring-redis。
28)spring-boot-starter-security
支持spring-security。
29)spring-boot-starter-social-facebook
支持spring-social-facebook
30)spring-boot-starter-social-linkedin
支持pring-social-linkedin
31)spring-boot-starter-social-twitter
支持pring-social-twitter
32)spring-boot-starter-test
支持常规的测试依赖,包括JUnit、Hamcrest、Mockito以及spring-test模块。
33)spring-boot-starter-thymeleaf
支持Thymeleaf模板引擎,包括与Spring的集成。
34)spring-boot-starter-velocity
支持Velocity模板引擎。
35)spring-boot-starter-web
S支持全栈式Web开发,包括Tomcat和spring-webmvc。
36)spring-boot-starter-websocket
支持WebSocket开发。
37)spring-boot-starter-ws
支持Spring Web Services。
Spring Boot应用启动器面向生产环境的还有2种,具体如下:
1)spring-boot-starter-actuator
增加了面向产品上线相关的功能,比如测量和监控。
2)spring-boot-starter-remote-shell
增加了远程ssh shell的支持。
最后,Spring Boot应用启动器还有一些替换技术的启动器,具体如下:
1)spring-boot-starter-jetty
引入了Jetty HTTP引擎(用于替换Tomcat)。
2)spring-boot-starter-log4j
支持Log4J日志框架。
3)spring-boot-starter-logging
引入了Spring Boot默认的日志框架Logback。
4)spring-boot-starter-tomcat
引入了Spring Boot默认的HTTP引擎Tomcat。
5)spring-boot-starter-undertow
引入了Undertow HTTP引擎(用于替换Tomcat)。

附录B. Spring Boot 配置文件application.properties

  1. #SPRING CONFIG (ConfigFileApplicationListener)
  2. spring.config.name= # config file name (default to 'application')
  3. spring.config.location= # location of config file
  4. #PROFILES
  5. spring.profiles= # comma list of active profiles
  6. #APPLICATION SETTINGS (SpringApplication)
  7. spring.main.sources=
  8. spring.main.web-environment= # detect by default
  9. spring.main.show-banner=true
  10. spring.main....= # see class for all properties
  11. #LOGGING
  12. logging.path=/var/logs
  13. logging.file=myapp.log
  14. logging.config=
  15. #IDENTITY (ContextIdApplicationContextInitializer)
  16. spring.application.name=
  17. spring.application.index=
  18. #EMBEDDED SERVER CONFIGURATION (ServerProperties)
  19. server.port=8080
  20. server.address= # bind to a specific NIC
  21. server.session-timeout= # session timeout in seconds
  22. server.context-path= # the context path, defaults to '/'
  23. server.servlet-path= # the servlet path, defaults to '/'
  24. server.tomcat.access-log-pattern= # log pattern of the access log
  25. server.tomcat.access-log-enabled=false # is access logging enabled
  26. server.tomcat.protocol-header=x-forwarded-proto # ssl forward headers
  27. server.tomcat.remote-ip-header=x-forwarded-for
  28. server.tomcat.basedir=/tmp # base dir (usually not needed, defaults to tmp)
  29. server.tomcat.background-processor-delay=30; # in seconds
  30. server.tomcat.max-threads = 0 # number of threads in protocol handler
  31. server.tomcat.uri-encoding = UTF-8 # character encoding to use for URL decoding
  32. #SPRING MVC (HttpMapperProperties)
  33. http.mappers.json-pretty-print=false # pretty print JSON
  34. http.mappers.json-sort-keys=false # sort keys
  35. spring.mvc.locale= # set fixed locale, e.g. enUK
  36. spring.mvc.date-format= # set fixed date format, e.g. dd/MM/yyyy
  37. spring.mvc.message-codes-resolver-format= # PREFIXERRORCODE / POSTFIXERROR_CODE
  38. spring.view.prefix= # MVC view prefix
  39. spring.view.suffix= # ... and suffix
  40. spring.resources.cache-period= # cache timeouts in headers sent to browser
  41. spring.resources.add-mappings=true # if default mappings should be added
  42. #THYMELEAF (ThymeleafAutoConfiguration)
  43. spring.thymeleaf.prefix=classpath:/templates/
  44. spring.thymeleaf.suffix=.html
  45. spring.thymeleaf.mode=HTML5
  46. spring.thymeleaf.encoding=UTF-8
  47. spring.thymeleaf.content-type=text/html # ;charset=<encoding> is added
  48. spring.thymeleaf.cache=true # set to false for hot refresh
  49. #FREEMARKER (FreeMarkerAutoConfiguration)
  50. spring.freemarker.allowRequestOverride=false
  51. spring.freemarker.allowSessionOverride=false
  52. spring.freemarker.cache=true
  53. spring.freemarker.checkTemplateLocation=true
  54. spring.freemarker.contentType=text/html
  55. spring.freemarker.exposeRequestAttributes=false
  56. spring.freemarker.exposeSessionAttributes=false
  57. spring.freemarker.exposeSpringMacroHelpers=false
  58. spring.freemarker.prefix=
  59. spring.freemarker.requestContextAttribute=
  60. spring.freemarker.settings.*=
  61. spring.freemarker.suffix=.ftl
  62. spring.freemarker.templateEncoding=UTF-8
  63. spring.freemarker.templateLoaderPath=classpath:/templates/
  64. spring.freemarker.viewNames= # whitelist of view names that can be resolved
  65. #GROOVY TEMPLATES (GroovyTemplateAutoConfiguration)
  66. spring.groovy.template.allowRequestOverride=false
  67. spring.groovy.template.allowSessionOverride=false
  68. spring.groovy.template.cache=true
  69. spring.groovy.template.configuration.*= # See Groovy's TemplateConfiguration
  70. spring.groovy.template.contentType=text/html
  71. spring.groovy.template.prefix=classpath:/templates/
  72. spring.groovy.template.suffix=.tpl
  73. spring.groovy.template.templateEncoding=UTF-8
  74. spring.groovy.template.viewNames= # whitelist of view names that can be resolved
  75. #VELOCITY TEMPLATES (VelocityAutoConfiguration)
  76. spring.velocity.allowRequestOverride=false
  77. spring.velocity.allowSessionOverride=false
  78. spring.velocity.cache=true
  79. spring.velocity.checkTemplateLocation=true
  80. spring.velocity.contentType=text/html
  81. spring.velocity.dateToolAttribute=
  82. spring.velocity.exposeRequestAttributes=false
  83. spring.velocity.exposeSessionAttributes=false
  84. spring.velocity.exposeSpringMacroHelpers=false
  85. spring.velocity.numberToolAttribute=
  86. spring.velocity.prefix=
  87. spring.velocity.properties.*=
  88. spring.velocity.requestContextAttribute=
  89. spring.velocity.resourceLoaderPath=classpath:/templates/
  90. spring.velocity.suffix=.vm
  91. spring.velocity.templateEncoding=UTF-8
  92. spring.velocity.viewNames= # whitelist of view names that can be resolved
  93. #INTERNATIONALIZATION (MessageSourceAutoConfiguration)
  94. spring.messages.basename=messages
  95. spring.messages.cacheSeconds=-1
  96. spring.messages.encoding=UTF-8
  97. #SECURITY (SecurityProperties)
  98. security.user.name=user # login username
  99. security.user.password= # login password
  100. security.user.role=USER # role assigned to the user
  101. security.require-ssl=false # advanced settings ...
  102. security.enable-csrf=false
  103. security.basic.enabled=true
  104. security.basic.realm=Spring
  105. security.basic.path= # /**
  106. security.headers.xss=false
  107. security.headers.cache=false
  108. security.headers.frame=false
  109. security.headers.contentType=false
  110. security.headers.hsts=all # none / domain / all
  111. security.sessions=stateless # always / never / if_required / stateless
  112. security.ignored=false
  113. #DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
  114. spring.datasource.name= # name of the data source
  115. spring.datasource.initialize=true # populate using data.sql
  116. spring.datasource.schema= # a schema (DDL) script resource reference
  117. spring.datasource.data= # a data (DML) script resource reference
  118. spring.datasource.platform= # the platform to use in the schema resource (schema-${platform}.sql)
  119. spring.datasource.continueOnError=false # continue even if can't be initialized
  120. spring.datasource.separator=; # statement separator in SQL initialization scripts
  121. spring.datasource.driverClassName= # JDBC Settings...
  122. spring.datasource.url=
  123. spring.datasource.username=
  124. spring.datasource.password=
  125. spring.datasource.max-active=100 # Advanced configuration...
  126. spring.datasource.max-idle=8
  127. spring.datasource.min-idle=8
  128. spring.datasource.initial-size=10
  129. spring.datasource.validation-query=
  130. spring.datasource.test-on-borrow=false
  131. spring.datasource.test-on-return=false
  132. spring.datasource.test-while-idle=
  133. spring.datasource.time-between-eviction-runs-millis=
  134. spring.datasource.min-evictable-idle-time-millis=
  135. spring.datasource.max-wait-millis=
  136. #MONGODB (MongoProperties)
  137. spring.data.mongodb.host= # the db host
  138. spring.data.mongodb.port=27017 # the connection port (defaults to 27107)
  139. spring.data.mongodb.uri=mongodb://localhost/test # connection URL
  140. spring.data.mongo.repositories.enabled=true # if spring data repository support is enabled
  141. #JPA (JpaBaseConfiguration, HibernateJpaAutoConfiguration)
  142. spring.jpa.properties.*= # properties to set on the JPA connection
  143. spring.jpa.openInView=true
  144. spring.jpa.show-sql=true
  145. spring.jpa.database-platform=
  146. spring.jpa.database=
  147. spring.jpa.generate-ddl=false # ignored by Hibernate, might be useful for other vendors
  148. spring.jpa.hibernate.naming-strategy= # naming classname
  149. spring.jpa.hibernate.ddl-auto= # defaults to create-drop for embedded dbs
  150. spring.data.jpa.repositories.enabled=true # if spring data repository support is enabled
  151. #SOLR (SolrProperties})
  152. spring.data.solr.host=http://127.0.0.1:8983/solr
  153. spring.data.solr.zkHost=
  154. spring.data.solr.repositories.enabled=true # if spring data repository support is enabled
  155. #ELASTICSEARCH (ElasticsearchProperties})
  156. spring.data.elasticsearch.cluster-name= # The cluster name (defaults to elasticsearch)
  157. spring.data.elasticsearch.cluster-nodes= # The address(es) of the server node (comma-separated; if not specified starts a client node)
  158. spring.data.elasticsearch.local=true # if local mode should be used with client nodes
  159. spring.data.elasticsearch.repositories.enabled=true # if spring data repository support is enabled
  160. #FLYWAY (FlywayProperties)
  161. flyway.locations=classpath:db/migrations # locations of migrations scripts
  162. flyway.schemas= # schemas to update
  163. flyway.initVersion= 1 # version to start migration
  164. flyway.prefix=V
  165. flyway.suffix=.sql
  166. flyway.enabled=true
  167. flyway.url= # JDBC url if you want Flyway to create its own DataSource
  168. flyway.user= # JDBC username if you want Flyway to create its own DataSource
  169. flyway.password= # JDBC password if you want Flyway to create its own DataSource
  170. #LIQUIBASE (LiquibaseProperties)
  171. liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml
  172. liquibase.contexts= # runtime contexts to use
  173. liquibase.default-schema= # default database schema to use
  174. liquibase.drop-first=false
  175. liquibase.enabled=true
  176. #JMX
  177. spring.jmx.enabled=true # Expose MBeans from Spring
  178. #ABBIT (RabbitProperties)
  179. spring.rabbitmq.host= # connection host
  180. spring.rabbitmq.port= # connection port
  181. spring.rabbitmq.addresses= # connection addresses (e.g. myhost:9999,otherhost:1111)
  182. spring.rabbitmq.username= # login user
  183. spring.rabbitmq.password= # login password
  184. spring.rabbitmq.virtualhost=
  185. spring.rabbitmq.dynamic=
  186. #REDIS (RedisProperties)
  187. spring.redis.host=localhost # server host
  188. spring.redis.password= # server password
  189. spring.redis.port=6379 # connection port
  190. spring.redis.pool.max-idle=8 # pool settings ...
  191. spring.redis.pool.min-idle=0
  192. spring.redis.pool.max-active=8
  193. spring.redis.pool.max-wait=-1
  194. #ACTIVEMQ (ActiveMQProperties)
  195. spring.activemq.broker-url=tcp://localhost:61616 # connection URL
  196. spring.activemq.user=
  197. spring.activemq.password=
  198. spring.activemq.in-memory=true # broker kind to create if no broker-url is specified
  199. spring.activemq.pooled=false
  200. #HornetQ (HornetQProperties)
  201. spring.hornetq.mode= # connection mode (native, embedded)
  202. spring.hornetq.host=localhost # hornetQ host (native mode)
  203. spring.hornetq.port=5445 # hornetQ port (native mode)
  204. spring.hornetq.embedded.enabled=true # if the embedded server is enabled (needs hornetq-jms-server.jar)
  205. spring.hornetq.embedded.serverId= # auto-generated id of the embedded server (integer)
  206. spring.hornetq.embedded.persistent=false # message persistence
  207. spring.hornetq.embedded.data-directory= # location of data content (when persistence is enabled)
  208. spring.hornetq.embedded.queues= # comma separate queues to create on startup
  209. spring.hornetq.embedded.topics= # comma separate topics to create on startup
  210. spring.hornetq.embedded.cluster-password= # customer password (randomly generated by default)
  211. #JMS (JmsProperties)
  212. spring.jms.pub-sub-domain= # false for queue (default), true for topic
  213. #SPRING BATCH (BatchDatabaseInitializer)
  214. spring.batch.job.names=job1,job2
  215. spring.batch.job.enabled=true
  216. spring.batch.initializer.enabled=true
  217. spring.batch.schema= # batch schema to load
  218. #AOP
  219. spring.aop.auto=
  220. spring.aop.proxy-target-class=
  221. #FILE ENCODING (FileEncodingApplicationListener)
  222. spring.mandatory-file-encoding=false
  223. #SPRING SOCIAL (SocialWebAutoConfiguration)
  224. spring.social.auto-connection-views=true # Set to true for default connection views or false if you provide your own
  225. #SPRING SOCIAL FACEBOOK (FacebookAutoConfiguration)
  226. spring.social.facebook.app-id= # your application's Facebook App ID
  227. spring.social.facebook.app-secret= # your application's Facebook App Secret
  228. #SPRING SOCIAL LINKEDIN (LinkedInAutoConfiguration)
  229. spring.social.linkedin.app-id= # your application's LinkedIn App ID
  230. spring.social.linkedin.app-secret= # your application's LinkedIn App Secret
  231. #SPRING SOCIAL TWITTER (TwitterAutoConfiguration)
  232. spring.social.twitter.app-id= # your application's Twitter App ID
  233. spring.social.twitter.app-secret= # your application's Twitter App Secret
  234. #SPRING MOBILE SITE PREFERENCE (SitePreferenceAutoConfiguration)
  235. spring.mobile.sitepreference.enabled=true # enabled by default
  236. #SPRING MOBILE DEVICE VIEWS (DeviceDelegatingViewResolverAutoConfiguration)
  237. spring.mobile.devicedelegatingviewresolver.enabled=true # disabled by default
  238. spring.mobile.devicedelegatingviewresolver.normalPrefix=
  239. spring.mobile.devicedelegatingviewresolver.normalSuffix=
  240. spring.mobile.devicedelegatingviewresolver.mobilePrefix=mobile/
  241. spring.mobile.devicedelegatingviewresolver.mobileSuffix=
  242. spring.mobile.devicedelegatingviewresolver.tabletPrefix=tablet/
  243. spring.mobile.devicedelegatingviewresolver.tabletSuffix=
  244. ######========ACTUATOR PROPERTIES===========
  245. #MANAGEMENT HTTP SERVER (ManagementServerProperties)
  246. management.port= # defaults to 'server.port'
  247. management.address= # bind to a specific NIC
  248. management.contextPath= # default to '/'
  249. #ENDPOINTS (AbstractEndpoint subclasses)
  250. endpoints.autoconfig.id=autoconfig
  251. endpoints.autoconfig.sensitive=true
  252. endpoints.autoconfig.enabled=true
  253. endpoints.beans.id=beans
  254. endpoints.beans.sensitive=true
  255. endpoints.beans.enabled=true
  256. endpoints.configprops.id=configprops
  257. endpoints.configprops.sensitive=true
  258. endpoints.configprops.enabled=true
  259. endpoints.configprops.keys-to-sanitize=password,secret
  260. endpoints.dump.id=dump
  261. endpoints.dump.sensitive=true
  262. endpoints.dump.enabled=true
  263. endpoints.env.id=env
  264. endpoints.env.sensitive=true
  265. endpoints.env.enabled=true
  266. endpoints.health.id=health
  267. endpoints.health.sensitive=false
  268. endpoints.health.enabled=true
  269. endpoints.info.id=info
  270. endpoints.info.sensitive=false
  271. endpoints.info.enabled=true
  272. endpoints.metrics.id=metrics
  273. endpoints.metrics.sensitive=true
  274. endpoints.metrics.enabled=true
  275. endpoints.shutdown.id=shutdown
  276. endpoints.shutdown.sensitive=true
  277. endpoints.shutdown.enabled=false
  278. endpoints.trace.id=trace
  279. endpoints.trace.sensitive=true
  280. endpoints.trace.enabled=true
  281. #MVC ONLY ENDPOINTS
  282. endpoints.jolokia.path=jolokia
  283. endpoints.jolokia.sensitive=true
  284. endpoints.jolokia.enabled=true # when using Jolokia
  285. endpoints.error.path=/error
  286. #JMX ENDPOINT (EndpointMBeanExportProperties)
  287. endpoints.jmx.enabled=true
  288. endpoints.jmx.domain= # the JMX domain, defaults to 'org.springboot'
  289. endpoints.jmx.unique-names=false
  290. endpoints.jmx.enabled=true
  291. endpoints.jmx.staticNames=
  292. #JOLOKIA (JolokiaProperties)
  293. jolokia.config.*= # See Jolokia manual
  294. #REMOTE SHELL
  295. shell.auth=simple # jaas, key, simple, spring
  296. shell.command-refresh-interval=-1
  297. shell.command-path-pattern= # classpath:/commands/, classpath:/crash/commands/
  298. shell.config-path-patterns= # classpath:/crash/
  299. shell.disabled-plugins=false # don't expose plugins
  300. shell.ssh.enabled= # ssh settings ...
  301. shell.ssh.keyPath=
  302. shell.ssh.port=
  303. shell.telnet.enabled= # telnet settings ...
  304. shell.telnet.port=
  305. shell.auth.jaas.domain= # authentication settings ...
  306. shell.auth.key.path=
  307. shell.auth.simple.user.name=
  308. shell.auth.simple.user.password=
  309. shell.auth.spring.roles=
  310. #GIT INFO
  311. spring.git.properties= # resource ref to generated git info properties file