配置
aliyun.sms.regionId=default aliyun.sms.accessKeyId=LTAIxxx aliyun.sms.secret=PAxxxx
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @Component public class ConstantPropertiesUtils implements InitializingBean { @Value("${aliyun.sms.regionId}") private String regionId; @Value("${aliyun.sms.accessKeyId}") private String accessKeyId; @Value("${aliyun.sms.secret}") private String secret; //对外提供 public static String REGION_Id; public static String ACCESS_KEY_ID; public static String SECRECT; @Override public void afterPropertiesSet() throws Exception { REGION_Id=regionId; ACCESS_KEY_ID=accessKeyId; SECRECT=secret; } }
标签:String,配置文件,regionId,sms,public,application,secret,aliyun,properties From: https://www.cnblogs.com/ixtao/p/17438505.html