【深入學習Mybatis】Chapter1源碼調試環境搭建

Mybatis簡介

Mybatis 是一個一流的持久化框架,支持自定義SQL,存儲過程和高級映射。
Mybatis幾乎消除了所有的JDBC代碼以及參數的手動設置和結果檢索。Mybatis可以使用簡單的XML或註釋進行配置,並將原函數,映射接口和Java Pojo 映射到數據庫記錄。

MyBatis is a first class persistence framework with support for custom SQL, stored procedures and advanced mappings. MyBatis eliminates almost all of the JDBC code and manual setting of parameters and retrieval of results. MyBatis can use simple XML or Annotations for configuration and map primitives, Map interfaces and Java POJOs (Plain Old Java Objects) to database records.

環境信息

  • macOS Catalina
  • Git
  • JDK8
  • Maven3
  • Intellij

克隆源碼到本地

git clone https://github.com/mybatis/mybatis-3.git

將源碼導出本地

File > New > Project from Existing sources

選擇源碼目錄將源碼導入Intellij ,等待IDEA構建項目結構,時間可能會長一點兒

導入結構如圖
mybatis 源碼包結構圖

運行測試用例

org.apache.ibatis.autoconstructor.AutoConstructorTest.fullyPopulatedSubject()

控制檯輸出如下信息說明環境搭建成功


Process finished with exit code 0

源碼包結構說明

.
└── org
    └── apache
        └── ibatis
            ├── annotations \\ 註解模塊 包含所有在mapper接口用到的註解
            ├── binding \\Bings mapper interfaces with mapped statements
            ├── builder \\ Base package for the Configuration building code
            ├── cache \\ 緩存模塊
            ├── cursor \\ 遊標模塊
            ├── datasource \\ 數據源模塊
            ├── exceptions \\ 異常模塊
            ├── executor \\ 執行模塊
            ├── io \\ 讀取資源的工具
            ├── jdbc \\ JDBC工具類
            ├── lang \\ 
            ├── logging \\ 日誌模塊
            ├── mapping \\ 映射模塊
            ├── parsing \\ 解析工具
            ├── plugin \\ 插件模塊
            ├── reflection \\ 反射模塊
            ├── scripting \\ SQL 解析
            ├── session \\ SQL會話
            ├── transaction \\ 事務模塊
            └── type \\ 類型處理器

參考資料


  • https://github.com/mybatis/mybatis-3
  • https://mybatis.org/mybatis-3/
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章