mirror of https://gitee.com/y_project/RuoYi.git
!384 【轻量级PR】新增SpringUtils.getRequiredProperty,以静态方式获取配置文件中的值
Merge pull request !384 from 阿超/masterpull/387/head
commit
7506ac77cb
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue