SqlSessionFactory工厂

模板:

 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     }

 

posted @ 2023-01-11 16:16  阿飞藏泪  阅读(41)  评论(0编辑  收藏  举报
1 2 3
4