配置文件中的配置,在程序中关联起来,就是上面的几个配置。
其中在配置文件当中,还能够通过占位符,做一点小技巧。
@ConfigurationProperties - application.properties
@Value - 单值
@PropertySource - person.properties
@ImportResource - spring配置的bean.xml
RandomValuePropertySource:配置文件中可以使用随机数
${random.value}
${random.int}
${random.long}
${random.int(10)}
${random.int[1024,65536]}
app.name=MyApp
app.description=${app.name:hello} is a Spring Boot application
原文:https://www.cnblogs.com/gnuzsx/p/12808247.html