// 调用Mybatis完成查询 // 获取SqlSessionFactory对象 String resource = "mybatis-config.xml"; InputStream inputStream = Resources.getResourceAsStream(resource); SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); //获取SqlSession对象 SqlSession sqlSession = sqlSessionFactory.openSession(); // 获取Mapper UserMapper userMapper = sqlSession.getMapper(UserMapper.class);
使用SqlSession
最新推荐文章于 2024-05-25 10:24:23 发布