spring配置文件和spring mvc配置文件的区别
Question:
- Are
applicationContext.xmlandspring-servlet.xmlrelated anyhow in Spring Framework? - Will the properties files declared in
applicationContext.xmlbe available toDispatcherServlet? - On a related note, why do I need a
*-servlet.xmlat all? Why isapplicationContext.xmlalone insufficient?
Answer:
Spring lets you define multiple contexts in a parent-child hierarchy.
The applicationContext.xml defines the beans for the "root webapp context", i.e. the context associated with the webapp.
The spring-servlet.xml (or whatever else you call it) defines the beans for one servlet's app context. There can be many of these in a webapp, one per Spring servlet (e.g. spring1-servlet.xmlfor servlet spring1, spring2-servlet.xml for servlet spring2).
Beans in spring-servlet.xml can reference beans in applicationContext.xml, but not vice versa.
All Spring MVC controllers must go in the spring-servlet.xml context.
In most simple cases, the applicationContext.xml context is unnecessary. It is generally used to contain beans that are shared between all servlets in a webapp. If you only have one servlet, then there's not really much point, unless you have a specific use for it.
spring配置文件和spring mvc配置文件的区别的更多相关文章
- Spring MVC配置文件的三个常用配置详解
转自:http://www.cnblogs.com/benwu/articles/5162614.html Spring MVC项目中通常会有二个配置文件,sprng-servlet.xml和appl ...
- spring+hibernate+jpa+Druid的配置文件,spring整合Druid
spring+hibernate+jpa+Druid的配置文件 spring+hibernate+jpa+Druid的完整配置 spring+hibernate+jpa+Druid的数据源配置 spr ...
- spring mvc context-param init-param 区别
init-param:mvc 配置文件context-param spring配置文件
- spring boot与spring mvc的区别
Spring 框架就像一个家族,有众多衍生产品例如 boot.security.jpa等等.但他们的基础都是Spring 的 ioc和 aop ioc 提供了依赖注入的容器 aop ,解决了面向横切面 ...
- 2017.2.13 开涛shiro教程-第十二章-与Spring集成(一)配置文件详解
原博客地址:http://jinnianshilongnian.iteye.com/blog/2018398 根据下载的pdf学习. 第十二章-与Spring集成(一)配置文件详解 1.pom.xml ...
- Spring中两种引入配置文件方式
用过Spring的人都知道,我们一般把数据库的配置.日志的配置或者其他的通用配置放在单独的配置文件中,在和Spring整合时,一般通过以下两种方法引入: <context:property-pl ...
- Spring Boot 核心注解与配置文件
@SpringBootApplication注解 Spring Boot项目有一个入口类 (*Application) 在这个类中有一个main 方法,是运行该项目的切入点.而@SpringBootA ...
- Spring Boot 与 Spring MVC到底有什么区别
前言 Spring 框架就像一个家族,有众多衍生产品例如 boot.security.jpa等等.但他们的基础都是Spring 的 ioc和 aop ioc 提供了依赖注入的容器 aop ,解决了面向 ...
- spring加载多个配置文件
首先我们都知道要使用spring,则需要在web.xml中增加如下代码: web.xml: 1:<listener><listener-class>org.springfram ...
- Spring中加载xml配置文件的六种方式
Spring中加载xml配置文件的六种方式 博客分类: Spring&EJB XMLSpringWebBeanBlog 因为目前正在从事一个项目,项目中一个需求就是所有的功能都是插件的形式装 ...
随机推荐
- JavaWeb_(Spring框架)用户登陆Spring整合到Servlet中
一.使用servlet技术开发用户登陆功能 在MySQL中准备一个user表,表中增加一条假数据 使用Servlet实现用户登陆的功能 用户登陆的<from>表单 <form id= ...
- PHP 之文件上传类封装
一.前端代码 <!doctype html> <html lang="en"> <head> <meta charset="UT ...
- 64位linux下玩32位汇编编程
利用下假期,打算把linux下的汇编语言给熟悉下,结果是以32位为版本的,只能在办公室的机器上跑了个opensuse的32位版本,家里的suse挂了,无法输入中文.打算再安装下32位系统,今天找到了个 ...
- 一文教你读懂Python中的异常信息
正文共:11813 字 2 图 预计阅读时间: 30 分钟 原文:https://realpython.com/python-traceback/ 译者:陈祥安 原文有所改动. 在写 Python 代 ...
- geth run
geth --networkid 1201 --rpc --rpcapi eth,net,web3,personal,admin,miner --rpccorsdomain "*" ...
- win10设置开机开启数字锁定
windows10开机小键盘默认关闭,网上查询修改InitialKeyboardIndicators键值为2,或者80000002,经过实际测试,均无效,键值8000000002有效,是中间8个0,开 ...
- linux 测试磁盘iops 方法详解
一.FIO安装 wget http://brick.kernel.dk/snaps/fio-2.0.7.tar.gz yum -y install libaio-devel tar -zxvf ...
- win10 Java JDK环境变量配置
注意下载JDK 版本不需太高(百度一下jdk下载就好了) 第一步 我们首先打开win10电脑的资源管理器,快捷键win+E 然后选中此电脑,鼠标右键在弹出的菜单中选中属性的按钮 第二步 看到窗口的 ...
- LVS+Keepalived小试牛刀
一.ipvsadm命令1.基本命令操作1.1)添加规则 ipvsadm -A|E -t|u|f service-address [-s scheduler] [-p timeout] [-M netm ...
- 将ByteBuffer保存成文件
String dest = "d:/download/" + name; Path path = Paths.get(dest).getParent().toAbsolutePat ...