List of usage examples for org.apache.ibatis.binding MapperProxyFactory newInstance
public T newInstance(SqlSession sqlSession)
From source file:com.baomidou.mybatisplus.MybatisMapperRegistry.java
License:Apache License
@SuppressWarnings("unchecked") public <T> T getMapper(Class<T> type, SqlSession sqlSession) { final MapperProxyFactory<T> mapperProxyFactory = (MapperProxyFactory<T>) knownMappers.get(type); if (mapperProxyFactory == null) { throw new BindingException("Type " + type + " is not known to the MybatisPlusMapperRegistry."); }//w ww .j a va2 s . c o m try { return mapperProxyFactory.newInstance(sqlSession); } catch (Exception e) { throw new BindingException("Error getting mapper instance. Cause: " + e, e); } }