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 + '\'' +
                '}';
    }
}

 

转载于:https://www.cnblogs.com/gjack/p/10114556.html

你可能感兴趣的:(springboot-获取文本数据)