读取配置信息类
springboot导出配置信息作为一个类的常见操作
@Component
@ConfigurationProperties(prefix = "aliyun.oss.file")
/* 这里去实现一个InitializingBean初始化bean的类 */
public class PropertiesUtils implements InitializingBean {
@Override
public void afterPropertiesSet() throws Exception {
//在bean赋值创建好之后进行的操作
END_POINT = endpoint;
KEY_ID = keyid;
KEY_SECRET = keysecret;
BUCKET_NAME = bucketname;
}
private static String END_POINT;
private static String KEY_ID;
private static String KEY_SECRET;
private static String BUCKET_NAME;
private String endpoint;
private String keyid;
private String keysecret;
private String bucketname;
}
通常这么创建需要导出配置信息类