@Test public void testGetSqlSessionFactory() throws Exception { SqlSessionFactory sqlSessionFactory = MybatisUtil.getSqlSessionFactory(); Assert.assertNotNull(sqlSessionFactory); }
public static SqlSessionFactory getSqlSessionFactory() { String mybatisConfigPath = "config/mybatis/mybatis.xml"; try { InputStream inputStream = Resources.getResourceAsStream(mybatisConfigPath); if (sqlSessionFactory == null) { sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); } } catch (IOException e) { e.printStackTrace(); } return sqlSessionFactory; }
MybatisUtil { public static SqlSessionFactory getSqlSessionFactory() { String mybatisConfigPath = "config/mybatis/mybatis.xml"; try { InputStream inputStream = Resources.getResourceAsStream(mybatisConfigPath); if (sqlSessionFactory == null) { sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); } } catch (IOException e) { e.printStackTrace(); } return sqlSessionFactory; } }
MybatisUtil { public static SqlSessionFactory getSqlSessionFactory() { String mybatisConfigPath = "config/mybatis/mybatis.xml"; try { InputStream inputStream = Resources.getResourceAsStream(mybatisConfigPath); if (sqlSessionFactory == null) { sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); } } catch (IOException e) { e.printStackTrace(); } return sqlSessionFactory; }  }
MybatisUtil { public static SqlSessionFactory getSqlSessionFactory() { String mybatisConfigPath = "config/mybatis/mybatis.xml"; try { InputStream inputStream = Resources.getResourceAsStream(mybatisConfigPath); if (sqlSessionFactory == null) { sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); } } catch (IOException e) { e.printStackTrace(); } return sqlSessionFactory; }  static SqlSessionFactory getSqlSessionFactory(); static SqlSession getSqlSession(); }
MybatisUtil { public static SqlSessionFactory getSqlSessionFactory() { String mybatisConfigPath = "config/mybatis/mybatis.xml"; try { InputStream inputStream = Resources.getResourceAsStream(mybatisConfigPath); if (sqlSessionFactory == null) { sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); } } catch (IOException e) { e.printStackTrace(); } return sqlSessionFactory; }  static SqlSessionFactory getSqlSessionFactory(); static SqlSession getSqlSession();  }