public static void main(String[] args) throws IOException {
ApplicationContext context = new AnnotationConfigApplicationContext();
Resource resource = context.getResource("file://D:\\yzyFile\\springDemo\\src\\main\\resources\\message_en_GB.properties");
File file = resource.getFile();
BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(file));
byte[] arr = new byte[1024];
int read = bufferedInputStream.read(arr);
while (read != -1){
String s = new String(arr);
System.out.println(s);
read = bufferedInputStream.read(arr);
}
}
spring资源加载,读取文件
最新推荐文章于 2024-05-18 16:40:18 发布