public static void main(String[] args) {
      String resource = "com/zx/model/mybatis-config.xml";
      SqlSession session = null;
      try {
         InputStream inputStream = Resources.getResourceAsStream(resource);
         SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder()
               .build(inputStream);
         session = sqlSessionFactory.openSession();
         /*
          * UserMapper mapper = session.getMapper(UserMapper.class); User user =
          * mapper.findUserById(1L);
          * System.out.println(user.getClasses().getName());
          * System.out.println(user.toString()); User user =
          * session.selectOne("com.zx.dao.UserMapper.findUserById", 1L);
          * List<User> userList = mapper.findAll(); for (User user : userList) {
          * } //
          */
//         Long startTime = System.currentTimeMillis();
         UserMapper mapper = session.getMapper(UserMapper.class);
         User user = mapper.findById(1L);
         System.out.println(user);
         // Long endTime = System.currentTimeMillis();
         // System.out.println(endTime-startTime);
         // ClassesMapper classesMapper =
         // session.getMapper(ClassesMapper.class);
         // HashMap<String, Object> data = new HashMap<String, Object>();
         // data.put("name", "高三四班");
         // classesMapper.insert(data);

         // Classes classes = classesMapper.findById(1);
         // System.out.println(classes.toString());
         // List<User> users = classes.getUsers();
         // for (User user : users) {
         // System.err.println(user.toString());
         // }
      } catch (IOException exception) {
         exception.printStackTrace();
      } finally {
         session.commit();
         if (session != null) {
            session.close();
         }
      }
   }