@PropertySource加载指定的配置文件,只能加载.properties结尾的文件
//读取指定的配置文件。value可以写成数组的方式,加载多个配置文件
@PropertySource(value={"classpath:person.properties"})
@Data
@Component
@ConfigurationProperties(prefix = "person")
public class Person {
private String name;
private Integer age;
}
对应的在person.properties配置文件里面添加name和age属性值
配置文件中占位符的使用
随机数及其他的库函数,以及之前就已经定义好的。使用${}这种方式来获取之前的值