📄 dbconfig.java
字号:
package com.runwit.ebookstore.services.dao;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public final class DbConfig {
private String url;
private String userName;
private String userPwd;
Properties prop;
private static DbConfig config;
private DbConfig() throws IOException{ //Class
InputStream is = DbConfig.class.getResourceAsStream("dbconnection.properties");
prop = new Properties();
prop.load(is);
url = prop.getProperty("url");
userName = prop.getProperty("user_name");
userPwd = prop.getProperty("user_pwd");
}
public String getUrl() {
return url;
}
public synchronized static DbConfig getInstance() throws IOException {
if(config == null)
config = new DbConfig();
return config;
}
public String getUserName() {
return userName;
}
public String getUserPwd() {
return userPwd;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -