@Configuration public class PropertiesUtils implements EnvironmentAware { private int redisExpireTime; private boolean enabled; private int refreshTime; @Override public void setEnvironment(Environment environment) { //解析配置文件头 RelaxedPropertyResolver relaxedPropertyResolver = new RelaxedPropertyResolver(environment, "custom."); this.redisExpireTime=Integer.valueOf(relaxedPropertyResolver.getProperty("redisExpireTime")); this.enabled=Boolean.valueOf(relaxedPropertyResolver.getProperty("enabled")); this.refreshTime=Integer.valueOf(relaxedPropertyResolver.getProperty("refreshTime")); }
原文地址:https://www.cnblogs.com/itniwota/p/9324312.html
时间: 2024-10-12 15:35:06