整合思路
1.Dao层:
Mybatis的配置文件:SqlMapConfig.xml
不需要配置任何内容,需要有文件头。文件必须存在。
applicationContext-dao.xml:
mybatis整合spring,通过由spring创建数据库连接池,spring管理SqlSessionFactory、mapper代理对象。需要mybatis和spring的整合包。
2.Service层:
applicationContext-service.xml:
所有的service实现类都放到spring容器中管理。并由spring管理事务。
3.表现层:
Springmvc框架,由springmvc管理controller。
Springmvc的三大组件。
整合步骤
db.properties
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/e3mall?characterEncoding=utf-8
jdbc.username=root
jdbc.password=root