dbutils封装ORM 实现BaseDAO

 Configurations.java

package com.dbutils.common;

import java.sql.*;

import java.util.*;
import java.lang.reflect.*;
import javax.sql.DataSource;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
* 数据库管理
*
*   */
@SuppressWarnings("unchecked")
public class Configurations {

private final static Log logger = LogFactory.getLog(Configurations.class);
private final static ThreadLocal<Connection> conns = new ThreadLocal<Connection>();
private static DataSource dataSource;
private static boolean show_sql = true;
private static BasicDataSource dbcpDataSource = null;
private static ResourceBundle res = null;
static {
initDataSource(null);
}

/**
* 初始化连接池
*
* @param props
* @param show_sql
*/
private final static void initDataSource(Properties dbProperties) {
try {
// 配置dbcp数据源

你可能感兴趣的:(封装)