读取spring配置文件的方法(spring读取资源文件)
2014-02-24 09:53
1546 查看
public void test() throws IOException { Resource resource = ApplicationContextFactory.getApplicationContext().getResource("classpath:com/springdemo/resource/test.txt"); File file = resource.getFile(); byte[] buffer =new byte[(int) file.length()]; FileInputStream is =new FileInputStream(file);
is.read(buffer, 0, buffer.length); is.close(); String str = new String(buffer); System.out.println(str);
}
相关文章推荐
- 读取spring配置文件的方法(spring读取资源文件)
- 读取spring配置文件的方法(spring读取资源文件)
- spring 读取资源文件方法
- 多个Spring配置文件时,读取方法
- java读取jar包中的资源文件或properties配置文件路径的方法
- Spring中配置和读取多个Properties文件的方式方法
- 读取Spring的配置文件applicationContext.xml的5种方法
- Java中spring读取配置文件的几种方法
- spring 读取配置文件的方法
- 读取Spring的配置文件applicationContext.xml几种方法
- 读取Spring配置文件 main方法里面测试实现功能
- 读取Spring的配置文件applicationContext.xml的5种方法
- springBoot使用Controller读取配置文件两种方式&读取自定义配置方法
- Spring读取配置文件中的bean与注入后的bean的方法
- Java中spring读取配置文件的几种方法示例
- 使用Spring中Src下 -context.xml : 用资源文件夹保存数据库的链接信息 并在配置文件里读取
- springboot读取资源文件配置(一)
- spring 读取配置文件的方法
- 读取spring配置文件的几种方法
- 读取Spring配置文件ApplicationContext.xml的5种方法