mybatis 解讀系列 配置解讀

2022-07-23 00:21:28 字數 614 閱讀 9201

介紹下專案情況:

springboot專案+mybatis,

先奉上啟動截圖,看看springboot啟動過程以及對mybatis配置的載入 :截圖如下

我們可以看到 createbean ,register, getsingleton。。。這些事springbean的載入過程。而後我們能看到sqlsessiontemplate(解釋在下)-也就是sqlsession 再我們就看到getconfiguration---讀取配置

sqlsessiontemplate-- spring對sqlsession做了封裝,當前spring事物去管理sqlsession的生命週期

MyBatis 原始碼解讀 配置解析過程

我們從mybatis config.xml 開始。在第一節課的時候我們已經分析了核心配置了,大概明白了mybatis 有哪些配置項,和這些配置項的大致含義。這裡我們再具體看一下這裡面的標籤都是怎麼解析的,解析的時候做了什麼。sqlsessionfactory sqlsessionfactory ne...

mybatis原始碼解讀(3)

string resource mybatis config.xml inputstream inputstream resources.getresourceasstream resource sqlsessionfactory sqlsessionfactory new sqlsessionfa...

mybatis原始碼解讀(7)

private void typealiaseselement xnode parent else else catch classnotfoundexception e alias author type domain.blog.author alias blog type domain.blog...