3、springboot配置文件占位符

RandomValuePropertySource:配置文件中可以使用随机数

${random.value}、${random.int}、${random.long}、${random.int(10)}、${random.int[]1024,65536}

person.name=张三:${random.uuid}
person.age=${random.int}
person.brith=2018/5/20
person.Boolean=true
person.lists=a,b,c
person.maps.k1=v1
person.maps.k2=v2
person.dog.name=${person.name} dog
person.dog.age=10
person.email=1223465@qq.com

属性配置占位符  

app.name=myApp
app.description=${app.name}is a spring boot application

可以在配置文件中引用前面配置过的属性(优先级前面配置过的这里都可以使用)

${app.name.默认值}:来指定当找不到属性值的时候指定属性的默认值

原文地址:https://www.cnblogs.com/huanghuanghui/p/9346427.html