既然是读取properties文件,那么我们先创建一个properties文件和一个yml文件,为了简单我们名字还是不变,如图
user.properties.name=ronnie o'sullivan
user.properties.age=45
user.properties.sex=male
[email protected]
useryml:
name: dingjunhui
age: 33
sex: male
email: [email protected]
一、使用`@ConfigurationProperties`注解将配置文件属性注入到自定义配置对象类中
(1)首先定义配置对象