属性文件(.properties)内容格式

 

driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/mydb
user=root 
password=111
characterEncoding=gb2312

 

属性文件的加载  

 

Properties props = new Properties();
InputStream in
= new BufferedInputStream(new FileInputStream(filePath));
props.load(in);

    属性的读取

    System .out.println("user:"+props.getProperty("user"));

     

    相关文章:

    • 2022-01-24
    • 2022-12-23
    • 2021-09-25
    • 2022-12-23
    • 2021-06-01
    • 2021-12-19
    • 2021-10-06
    • 2021-04-09
    猜你喜欢
    • 2021-10-30
    • 2022-12-23
    • 2021-05-12
    • 2021-09-22
    • 2021-04-26
    • 2022-12-23
    • 2022-12-23
    相关资源
    相似解决方案