新增SpringUtils.getRequiredProperty,以静态方式获取配置文件中的值

pull/384/head
VampireAchao 2022-05-04 22:38:03 +08:00
parent a4be143104
commit 2304f95b13
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);
}
}