反射与动态代理的关系
先展示下mybatis的动态代理是怎样的 结合上一篇文章实践的 String resource = "mybatis.xml" ; InputStream resourceAsStream = Resources . getResourceAsStream ( resource ) ; SqlSessionFactory factory = new SqlSessionFactoryBuilder ( ) . build ( resourceAsStream ) ; SqlSession sqlSession = factory . openSession ( ) ; // 不使用动态代理的情况下 try { List < User > userList = sqlSession . selectList ( "com.wyl.mybatis.dao.UserDao.getUserList" ) ; System . out . println ( "**********" + JSON . toJSON ( userList ) ) ; } finally { sqlSession . close ( ) ; } // 使用动态代理的情况下 try { UserDao userDao = sqlSession . getMapper ( UserDao . class ) ;