public class Test {
public static void main(String[] args) throws Exception {
String resource = "conf.xml";
Reader reader = Resources.getResourceAsReader(resource);
SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(reader);
SqlSession session = sessionFactory.openSession();
String statement = "com.bird.mybatis.bean.userMapper.getUser";
Users user = session.selectOne(statement, 1);
System.out.println(user);
}
}
总体来说还是非常简单的。