springboot-获取文本数据

@Component
@PropertySource("classpath:my2.properties")
@ConfigurationProperties(prefix = "my2")
public class MyProperties2 {

    private int age;
    private String name;
    private String email;
    // 省略 get set

    public String test() {
        System.out.print("test");
        return "return test";
    }

    @Override
    public String toString() {
        return "MyProperties2{" +
                "age=" + age +
                ", name='" + name + '\'' +
                ", email='" + email + '\'' +
                '}';
    }
}

 

posted @ 2018-12-13 16:05  爱吃醋的工程师  阅读(238)  评论(0编辑  收藏  举报