MCPcopy Create free account
hub / github.com/EthanWang-cn/JavaWeb_Mall / init

Method init

src/main/java/smbms/dao/BaseDao.java:25–38  ·  view source on GitHub ↗

读取配置文件对数据库初始化,使用静态代码块在类加载前调用

()

Source from the content-addressed store, hash-verified

23 * 读取配置文件对数据库初始化,使用静态代码块在类加载前调用
24 */
25 public static void init() {
26 InputStream resourceAsStream = BaseDao.class.getClassLoader().getResourceAsStream("db.properties");
27 Properties properties = new Properties();
28
29 try {
30 properties.load(resourceAsStream);
31 } catch (IOException e) {
32 e.printStackTrace();
33 }
34 driver = properties.getProperty("driver");
35 url = properties.getProperty("url");
36 user = properties.getProperty("user");
37 password = properties.getProperty("password");
38 }
39
40 /**
41 * 此方法获得一个connection连接

Callers 1

BaseDaoClass · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected