天天看點

搭建SSM架構配置

(1)resources下建立mybatis包 ,再在mybatis包下建立mapeer包與mybatis的配置檔案mybatis-config.xml

搭建SSM架構配置

(2)mybatis-config.xml 中配置包别名,如果用MybatisCodeHelper插件就不用配置包别名。用上分頁的話請加上分頁的配置。

搭建SSM架構配置

(3)** resources下建立log4j.properties**

(1)resources下建立spring包,spring包下建立spring容器的配置applicationContext.xml。**如果需要配置的東西比較多可以拆分成三個配置檔案

1)applicationContext-dao.xml

2)applicationContext-service.xml

3)applicationContext-transation.xml 事務的配置

(2)dao層需要配置的東西

1)配置c3p0連接配接池

2)配置會話工廠

3)mapper接口掃描器

(3)service層需要配置的東西

(4)transaction層需要配置的東西

1)配置jdbc資料源事務管理

2)開啟事務注解

tx:annotation-driven/

3)aop配置

<aop:aspectj-autoproxy proxy-target-class=“true”/>

Spring 3.0.x中使用了mvc:annotation-driven後,預設會幫我們注冊預設處理請求,參數和傳回值的類,可簡單了解為json轉換器mvc:annotation-driven/

搭建SSM架構配置

繼續閱讀