SpringMVC XXX-servlet.xml ApplicationContext.xml
2023-09-27 14:23:13 时间
因为直接使用了SpringMVC,所以之前一直不明白xxx-servlet.xml和applicationContext.xml是如何区别的,其实如果直接使用SpringMVC是可以不添加applicationContext.xml文件的。
使用applicationContext.xml文件时是需要在web.xml中添加listener的:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
而这个一般是采用非spring mvc架构,如使用struts之类而又想引入spring才添加的,这个是用来加载Application Context。
如果直接采用SpringMVC,只需要把所有相关配置放到xxx-servlet.xml中就OK了。
相关文章
- SpringMVC -- 梗概--源码--壹--收参
- springMVC 头像裁剪上传并等比压
- SSM(Spring+SpringMVC+Mybatis)极简整合完整示例(结构清晰三大框架仅需一个xml配置文件!)
- 实战SpringMVC+Mybatis搭建高性能安全站点
- JAVA-SpringMVC开发第一个应用
- 基于SSM(spring+springmvc+mybatis)+MySQL开发的新闻推荐系统【100010074】
- springmvc编码问题
- 基于XML搭建SpringMVC项目
- SpringMVC中的@PathVariable
- SpringMVC数据库连接配置
- SpringMVC拦截器简单配置
- SSM三大框架整合配置(Spring+SpringMVC+MyBatis)
- SpringMVC之application-context.xml,了解数据库相关配置
- springmvc Cacheable
- springmvc笔记(来自慕课网)
- SpringMVC入门