一、配置SpringMVC
1.1首先springmvc框架默认扫描的配置文件是在/WEB-INF/文件夹下面找springmvc-servlet.xml,而maven要放在resource中,所以修改web.xml的springMVC部分如下:
这里contextConfigLocation
一定要是contextConfigLocation!!!之前写错了这个导致找了好久错误
classpath的这个路径和java虚拟机有关
1.2修改springMVC.xml
注意这里的base-package填对应的controller
二、配置Spring
2.1配置web.xml
描述applicationContext.xml的位置
org.springframework.web.context.ContextLoaderListener
这个模块主要用来配置application.xml
(参考:https://blog.csdn.net/qq_15037231/article/details/78743765)
2.2applicationContext.xml
暂时留白(需要有:mybatis配置、spring扫描目录配置):
到此,基本SSM框架搭建完成。