XMLConfigBuilder是Mybatis中定义的进行构建Configuration对象的类,此类用于读取XML配置文件创建并初始化Configuration对象;本篇我们主要介绍加载XML文件与创建Configuration对象的过程。
下面是从Configuration类中取到的代码片段:
- public class Configuration {
- protected Properties variables = new Properties();
- protected final TypeHandlerRegistry typeHandlerRegistry = new TypeHandlerRegistry();
- protected final TypeAliasRegistry typeAliasRegistry = new TypeAliasRegistry();
- protected final LanguageDriverRegistry languageRegistry = new LanguageDriverRegistry();
- public Configuration() {
- typeAliasRegistry.registerAlias("JDBC", JdbcTransactionFactory.class);
- typeAliasRegistry.registerAlias("MANAGED", ManagedTransactionFactory.class);
-
- typeAliasRegistry.registerAlias("JNDI", JndiDataSourceFactory.class)