@Autowired private SqlSession sqlSession;
public Connection getConnection(){
Connection conn = null;
try {
conn = sqlSession.getConfiguration().getEnvironment().getDataSource().getConnection();
logger.info("===This Connection isClosed ? "+conn.isClosed());
} catch (Exception e) {
e.printStackTrace();
}
return conn;
}
String resource = "SqlMap.xml"; Reader reader = Resources.getResourceAsReader(resource);
SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
Connection db = sqlMap.getDataSource().getConnection();
Statement st = db.createStatement();
ResultSet rs = st.executeQuery("show tables");