Mybatis source read - file parsing configuration files and mapping

Mybatis source code analysis:

1. The configuration file parsing:

  1.1 Read Source inlet: org.apache.ibatis.builder.xml.XMLConfigBuilder.parse ();

 

   Function: parsing global profile, calling parse.evalNode () method converts the specified path profile for config XNode object and then call parseConfiguration () stepwise parses each node in the configuration file;

 

  1.2 mapperElement (): analytical mappers tag, the resolution process is to parse the process of mapping file

        

2. Mapper mapping file parsing:

    2.1 org.apache.ibatis.builder.xmlXMLMapperBuilder.parse () parse mapper mapping file;

          

   2.2 parsed mapper mapping file: org.apache.ibatis.builder.xmlXMLMapperBuilder.configurationElement () parse mapper mapping file;

                                                Comprising a request object (parameterMapElement ()), to return a result set (resultMapElements ()), SQL fragments (sqlElement ()), SELECT | INSERT | Update | Delete sub-tab (buildStatementFromContext ())

        

3. select | insert | update | delete sub-tab

     3.1 parsed select other four labels, create objects MappedStatement

3.2 parsing sql tag to the Senate, the Senate and the type of operation, SQL statements, create MappedStatement

 

Guess you like

Origin www.cnblogs.com/ZnCl/p/11519308.html