读取static 中读取SRC目录下的配置文件

获取SRC目录

InputStream input=当前ClassName.class.getClassLoader().getResourceAsStream("hibernate.cfg.xml");

获取编译后的bin目录

String binPath=HibernateSessionFactory.class.getClass().getResource("/").getPath();  
原文地址:https://www.cnblogs.com/qwj888/p/2733903.html