
Java 中什么是配置文件
Java中的配置文件名称一般都以“.properties”和“.xml”进行结尾,这些配置文件的结构都和Java的HashMap结构是一样的,其作用是通过修改配置文件来实现代码中的参数的更改,从而实现灵活变更参数。
properties使用
driver=com.mysql.jdbc.Driver jdbcUrl=jdbc:mysql://localhost:3306/user user=root password=123456
/**
* 读取config.properties文件中的内容,放到Properties类中
* @param filePath 文件路径
* @param key 配置文件中的key
* @return 返回key对应的value
*/
public static String readConfigFiles(String filePath,String key) {
Properties prop = new Properties();
try{
InputStream inputStream = new FileInputStream(filePath);
prop.load(inputStream);
inputStream.close();
return prop.getProperty(key);
}catch (Exception e) {
e.printStackTrace();
System.out.println("未找到相关配置文件");
return null;
}
}xml使用
MMM金融互助系统源码是以thinkphp为核心进行开发的3m金融互助平台。程序安装说明:1.恢复数据:将“数据备份”文件夹中的 urkeji.sql 文件请采用phpMyAdmin进行导入; 2.配置Sql数据库信息,文件路径:根目录下 config.php3.后台管理地址:http://域名/admin.php 用户名:100000 密码:admin1
立即学习“Java免费学习笔记(深入)”;
cxx1 Bob1 stars1 85 cxx2 Bob2 stars2 85 cxx3 Bob3 stars3 85
package com.cxx.xml;
import org.w3c.dom.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
/**
* @Author: cxx
* Dom操作xml
* @Date: 2018/5/29 20:19
*/
public class DomDemo {
//用Element方式
public static void element(NodeList list){
for (int i = 0; i 推荐教程:《Java教程》










