409a088031410018187e8f4f0cfd5be6
来自「订餐系统」· 代码 · 共 46 行
TXT
46 行
package Dao;
import java.util.*;
import java.io.*;
import java.sql.*;
import org.logicalcobwebs.proxool.configuration.PropertyConfigurator;
public final class Env{
private static Env instance;
public static Env getInstance()
{
if(instance != null)
{
return instance;
}
else
{
makeInstance();
return instance;
}
}
public static synchronized void makeInstance()
{
if(instance == null)
{
instance = new Env();
}
}
private Env()
{
Properties p = new Properties();
InputStream is = getClass().getResourceAsStream("db.properties");
try
{
p.load(is);
PropertyConfigurator.configure(p);
}catch(Exception e)
{
System.out.println("错误:没有读取属性文件,请确认db.properties文件是否存在");
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?