IO(1) : 读取resources下 properties配置文件

通过PropertiesLoaderUtils类来读取

import org.springframework.core.io.support.PropertiesLoaderUtils;
 

Properties properties = PropertiesLoaderUtils.loadAllProperties("test.properties");
String test = properties.getProperty("test");
System.out.println("properties.test:"+test);

只有运行状态下才能读取,建立 main 方法运行为空

参考 : https://www.cnblogs.com/viwofer/p/9003252.html

猜你喜欢

转载自blog.csdn.net/Lxinccode/article/details/82626880