Spring如何接管MyBatis
Mybatis :
Mybatis配置數(shù)據(jù)庫,SqlSessionFactory讀取Mybatis配置,開啟Session,調(diào)用Dao接口,Mapper與Dao對應(yīng),執(zhí)行語句調(diào)取數(shù)據(jù)庫信息給實(shí)體類。

Mybatis-spring:
spring-dao.xml配置數(shù)據(jù)庫,applicationContext配置DaoImpl。spring-dao.xml配置SqlSessionTemplate,通過applicationContext注入給DaoImpl。SqlSessionTemplate像Session一樣調(diào)用Dao,再到Mapper,再到數(shù)據(jù)庫。
