1:读取图片 图片位置在resources下
URL resource1
= getClass().getClassLoader().getResource("1.png");
2:读取配置文件 配置文件在resources下
String path
= "code.properties";
EncodedResource encodedResource
= new EncodedResource(new ClassPathResource(path
),
Charsets
.UTF_8
);
Properties properties
= PropertiesLoaderUtils
.loadProperties(encodedResource
);
String property
= properties
.getProperty("name");
转载请注明原文地址: https://lol.8miu.com/read-29263.html