Mybatis source code parsing (a): SqlSessionFactory

Mybatis process:

Here Insert Picture Description

Mybatis of the steps:

1. Obtain a SqlSessionFactory

  • First of all configuration information is stored in the configuration, including: settingsElement, mapperElement

  • settingsElement
    Here Insert Picture Description

  • folders item
    Here Insert Picture Description

  • Each mapper under resolution resource
    Here Insert Picture DescriptionHere Insert Picture Description
    Here Insert Picture Description
    Here Insert Picture Description
    Here Insert Picture Description
    Here Insert Picture Description

  • All xxxMapper file labels and parameters are stored in MappedStatement objects in
    Here Insert Picture Description

  • Then all the configuration information into configuration object tag

Here Insert Picture Description

  • Finally, because DefaultSqlSessionFactory implementation class is SqlSessionFactory
    Here Insert Picture Description
    Here Insert Picture Description
  • So you end up with a SqlSessionFactory

in conclusion:

A SqlSessionFactory - "DefaultSqlSessionFactory-" Configuration- "all the configuration information
Published 47 original articles · won praise 34 · views 8875

Guess you like

Origin blog.csdn.net/weixin_42893085/article/details/105138659