新增获取配置文件中的属性值方法

This commit is contained in:
RuoYi 2022-05-20 16:23:52 +08:00
parent 4a0619cadb
commit a92667c000
1 changed files with 12 additions and 0 deletions

View File

@ -143,4 +143,16 @@ 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);
}
}