!384 【轻量级PR】新增SpringUtils.getRequiredProperty,以静态方式获取配置文件中的值

Merge pull request !384 from 阿超/master
pull/387/head
若依 2022-05-20 02:48:48 +00:00 committed by Gitee
commit 7506ac77cb
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 159 additions and 146 deletions

View File

@ -143,4 +143,17 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC
final String[] activeProfiles = getActiveProfiles();
return StringUtils.isNotEmpty(activeProfiles) ? activeProfiles[0] : null;
}
/**
*
*
* @param key key
* @return
*
*/
public static String getRequiredProperty(String key)
{
return applicationContext.getEnvironment().getRequiredProperty(key);
}
}