java用class.getClassLoader().getResourceAsStream方式读取properties文件路径问题


class.getClassLoader().getResourceAsStream当中properties配置文件放到转移至 src目录下

如果出现这种情况pro.load(new FileReader("druid.properties");加载不出来类改成全路径路径

或者

FileInputStream fis = new FileInputStream(JdbcUtils.class.getResource("/").getPath() + "druid.properties");
Properties p = new Properties();
p.load(fis);

https://blog.csdn.net/weixin_42323802/article/details/82905840

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM