首页 > 其他 > 详细

读取properties文件

时间:2018-03-27 18:07:43      阅读:214      评论:0      收藏:0      [点我收藏+]

读取properties文件

InputStream in = getClass().getClassLoader().getResourceAsStream("jdbc.properties");
        Properties properties = new Properties();
        properties.load(in);
        driverClass = properties.getProperty("driver");
        jdbcURL = properties.getProperty("url");
        user = properties.getProperty("user");
        password = properties.getProperty("password");

 

peoperties配置文件的格式

driver=com.mysql.jdbc.Driver
url=jdbc:mysql://127.0.0.1:3306/test
user=root
password=123

  

读取properties文件

原文:https://www.cnblogs.com/xuyaoyao/p/8658704.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!