abel533 / Mapper

Mybatis Common Mapper - Easy to use
https://mybatis.io
MIT License
7.32k stars 1.63k forks source link

希望优化:MapperHelper#processConfiguration,配置指定接口时,会对所有MapperStatements做循环 #892

Open wushugenzz opened 11 months ago

wushugenzz commented 11 months ago
/**
 * 配置指定的接口
 *
 * @param configuration
 * @param mapperInterface
 */
public void processConfiguration(Configuration configuration, Class<?> mapperInterface) {
    String prefix;
    if (mapperInterface != null) {
        prefix = mapperInterface.getCanonicalName();
    } else {
        prefix = "";
    }
    for (Object object : new ArrayList<Object>(configuration.getMappedStatements())) {
        if (object instanceof MappedStatement) {
            MappedStatement ms = (MappedStatement) object;
            if (ms.getId().startsWith(prefix)) {
                processMappedStatement(ms);
            }
        }
    }
}
spring实例化Mapper时,对mapper接口时,配置指定接口时,会对所有MapperStatements做循环,目前实例化mapper耗时太久