ssm框架的配置文件解读(基于自己做的项目ssm_test)


1、applicationContext.xml
(1)引入数据库信息配置文件jdbc.properties
(2)扫描包,不扫描被controller注解的类,我自己的理解主要是扫描service接口
(3)导入spring和mybatis整合的配置文件:spring-mybatis.xml

2、spring-mvc.xml
(1)扫描controller所在的包
(2)开启mvc的注解
(3)静态资源的映射
(4)对模型视图添加前后缀(视图URL=前缀+controller的返回值+后缀)
3、spring-mybatis.xml
(1)配置数据源
(2)扫描mapper.xml等映射文件
(3)配置事务管理
(4)配置基于注解的声明式事务
4、web.xml
(1)读取spring的配置文件applicationContext.xml
(2)配置spring字符集过滤器
(3)配置日志、上下文等的监听器
(4)springMVC的核心配置(引入配置文件spring-mvc.xml)
(5)拦截设置(拦截所有的请求,都交给springMVC转发)
 

猜你喜欢

转载自blog.csdn.net/Sun_of_Rainy/article/details/83039618