@Overridepublic<T> T getMapper(Class<T> type){return configuration.<T>getMapper(type,this);}
configuration的getMapper方法
public<T> T getMapper(Class<T> type, SqlSession sqlSession){return mapperRegistry.getMapper(type, sqlSession);}
mapperRegistry的getMapper方法
public<T> T getMapper(Class<T> type, SqlSession sqlSession){final MapperProxyFactory<T> mapperProxyFactory =(MapperProxyFactory<T>) knownMappers.get(type);if(mapperProxyFactory == null){thrownewBindingException("Type "+ type +" is not known to the MapperRegistry.");}try{return mapperProxyFactory.newInstance(sqlSession);}catch(Exception e){thrownewBindingException("Error getting mapper instance. Cause: "+ e, e);}}
mapperProxyFactory的newInstance方法
protected T newInstance(MapperProxy<T> mapperProxy){return(T) Proxy.newProxyInstance(mapperInterface.getClassLoader(),newClass[]{ mapperInterface }, mapperProxy);}public T newInstance(SqlSession sqlSession){final MapperProxy<T> mapperProxy =newMapperProxy<T>(sqlSession, mapperInterface, methodCache);returnnewInstance(mapperProxy);}