package me.yoqi.model; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import java.util.Date; import java.util.List; import java.util.Map; /** * Created by liuyuqi on 8/31/2019. * @ConfigurationProperties 本类中所有属性都是配置文件中的属性,进行绑定。 */ @Component public class Person2 { @Value("${person.name}") private String name; @Value("${person.age}") private int age; private Boolean sex; @Value("true") private boolean isBoss; private Date birth; private Map maps; private List lists; private Dog dog; public String getName() { return name; } @Override public String toString() { return "Pserson{" + "name='" + name + '\'' + ", age=" + age + ", sex=" + sex + ", isBoss=" + isBoss + ", birth=" + birth + ", maps=" + maps + ", lists=" + lists + ", dog=" + dog + '}'; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public Boolean getSex() { return sex; } public void setSex(Boolean sex) { this.sex = sex; } public boolean isBoss() { return isBoss; } public void setBoss(boolean boss) { isBoss = boss; } public Date getBirth() { return birth; } public void setBirth(Date birth) { this.birth = birth; } public Map getMaps() { return maps; } public void setMaps(Map maps) { this.maps = maps; } public List getLists() { return lists; } public void setLists(List lists) { this.lists = lists; } public Dog getDog() { return dog; } public void setDog(Dog dog) { this.dog = dog; } }