springboot配置之配置文件占位符

  • RandomValuePropertySource:配置文件中可以使用随机数
    ${random.value}、${random.int}、${random.long}、${random.int(10)}、${random.int[123,456]}
  • 属性占位符
    app.name=MyApp
    app.description=${app.name} is a spring boot application
  • 可以在配置文件中使用前面配置过的属性
  • ${app.name:默认值}来指定找不到属性时的默认值
原文地址:https://www.cnblogs.com/xiximayou/p/12248232.html