JAVA 获取jdbc.properties配置信息

Properties myProperty = new Properties();
String jdbcPath = PathKit.getWebRootPath()+File.separator+"WEB-INF"+File.separator+"classes"+File.separator+"jdbc.properties" InputStream inputStream
= new FileInputStream(new File(jdbcPath)); myProperty.load(inputStream); String driverClass = myProperty.getProperty("driverClass"); String url = myProperty.getProperty("jdbcUrl"); String user = myProperty.getProperty("user"); String password = myProperty.getProperty("password");

PathKit.getWebRootPath()为JFinal获取路径的方法。

原文地址:https://www.cnblogs.com/kgdxpr/p/3205221.html