SpringBoot的所有配置项都是可以在官方文档找到的:官方配置详解
介绍:
Appendix A. Common application properties
Various properties can be specified inside your application.properties file, inside your application.yml file, or as command line switches. This appendix provides a list of common Spring Boot properties and references to the underlying classes that consume them.
(丰富的配置都可以被在application.properties、application.yml指定或者是命令行中切换,附录中提供了一些常用的配置List集合和这些配置的作用)
下面是附录的一部分
1、Property contributions can come from additional jar files on your classpath, so you should not consider this an exhaustive list. Also, you can define your own properties.
(配置的应用可以来自于你的classpath中的其他配置文件,你可以不参考附录中的配置,而去指定你自定义的配置)
2、This sample file is meant as a guide only. Do not copy and paste the entire content into your application. Rather, pick only the properties that you need.
(附录中的配置参数只是仅供参考的,不要整个粘贴复制到你项目中的配置项中去,更重要的是,需要去选择你需要修改的配置项进行合适的修改)
3、配置项的引用
在application.properties中的各个参数之间可以直接通过“${keyname}”引用来使用。
在application.properties中也可以通过“@keyname@”来引用pom文件中的元素节点值,例如:
3.1
pom文件中有如下定义:
<properties>
<project.name >easy-springboot-demo </ project.name >
<project.version>1.0</ project.version >
</properties>
3.2
则在application.properties文件中可以通过如下方式引用:
# 项目名称
com.easy.springboot.project.name = @project.name@
# 项目版本
com.easy.springboot.project.version = @project.version@
4、随机数属性value
在一些情况下,有些参数我们需要希望它不是一个固定的值,Spring Boot的属性配置文件中可以通过${random}来产生int值、long值或者string字符串,来支持属性的随机值。
# 随机字符串