在com.app.resource下有db.properties
读取
connection.driver=com.mysql.jdbc.Driver
connection.url=jdbc:mysql://localhost:3306/database
connection.username=root
connection.password=root
读取
try {
ResourceBundle bundle = ResourceBundle.getBundle("com/app/resource/db");
driver = bundle.getString("connection.driver");
url = bundle.getString("connection.url");
user = bundle.getString("connection.username");
pwd = bundle.getString("connection.password");
} catch (Exception ex) {
ex.printStackTrace();
}