添加配置文件处理器依赖
<!-- 配置文件处理器 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
Person 类
package com.kwok.springboot.bean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 将配置文件中的每一个属性的值映射到该组件中
* @ConfigurationProperties
*
* @Component 只有这个组件是容器中的组件,才能使用容器提供的 Configuration 功能
*/
@Component
@ConfigurationProperties(prefix = "person")
public class Person {<