以下是@beforeTest方法的示例代码:
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new ( SqlSessionFactoryBuilder().build(inputStream);
SqlSession session = sqlSessionFactory.openSession();
here couldnot open the connection
and the output testing under testNG is:
FAILED CONFIGURATION: @BeforeTest setupPermission
org.apache.ibatis.exceptions.PersistenceException:
Error opening session. Cause: java.lang.NullPointerException
Cause: java.lang.NullPointerException
------------------------------------------------------
我想使用Connection,但不确定myBatis在下面的代码中使用的是什么类型的连接:
SqlSession session = sqlSessionFactory.openSession(Connection con);