模板:
1 private static SqlSessionFactory sqlSessionFactory; 2 static { 3 String resource = "mybatis-config.xml"; 4 InputStream inputStream = null; 5 try { 6 inputStream = Resources.getResourceAsStream(resource); 7 } catch (IOException e) { 8 e.printStackTrace(); 9 } 10 sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); 11 } 12 public static SqlSessionFactory getSqlSessionFactory() 13 { 14 return sqlSessionFactory; 15 }
标签:sqlSessionFactory,resource,inputStream,SqlSessionFactory,static,工厂 From: https://www.cnblogs.com/daitu66/p/17044125.html