配置 jdbcTempalte 使用

public class JUtils {
    private static DataSource source;
    static{
        Properties pro = null;
        try{
            pro = new Properties();
            InputStream in = JUtils.class.getClassLoader().getResourceAsStream("druid.properties");
            pro.load(in);
            source = DruidDataSourceFactory.createDataSource(pro);
        }catch(IOException e){
            throw new RuntimeException(e);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    public static Connection getConnection() throws SQLException {
        return source.getConnection();
    }
    public static DataSource getSource() {
        return source;
    }
}