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 因为目前正在从事一个项目,项目中一个需求就是所有的功能都是插件的形式装 ...
随机推荐
- Js 之复制到剪贴板 clipboard.js
一.下载 https://github.com/zenorocha/clipboard.js/archive/master.zip 二.Demo示例 <!DOCTYPE html> < ...
- Jenkins 插件加速下载
本文主旨 看到好多加速Jenkins安装插件速度的文章,大多数教程中都是在插件配置里使用 https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/up ...
- Dubbo系列(三)dubbo的核心技术--RPC调用
dubbo的核心技术--RPC调用:分为俩部分RPC协议Protocol和方法调用Invoke: 一.RPC协议Protocol(Remote Procedure Call)远程过程调用协议 1.我们 ...
- 《你不知道的JavaScript(上)》笔记——函数作用域和块作用域
关于函数声明:如果 function 是声明中的第一个词, 那么就是一个函数声明, 否则就是一个函数表达式.例如匿名函数这种形式,函数会被当作函数表达式而不是一个标准的函数声明来处理. (functi ...
- 20190710记录:去掉中转图,直接以1280*1024进行反坐标计算,填补pbFinal。
1.记录:去掉中转图,直接以1280*1024进行反坐标计算.pbFinal=1280*1024. // Imagejoint.cpp : 定义控制台应用程序的入口点. // #include &qu ...
- ERS:百科
ylbtech-ERS:百科 ERS=(Enterprises Run System)企业运行系统 企业运行系统-ERS,是继ERP系统之后的企业管理控制软件系统的终极形式,有着非常美好的市场前景,尤 ...
- SQL-W3School-高级:SQL 通配符
ylbtech-SQL-W3School-高级:SQL 通配符 1.返回顶部 1. 在搜索数据库中的数据时,您可以使用 SQL 通配符. SQL 通配符 在搜索数据库中的数据时,SQL 通配符可以替代 ...
- kotlin中匿名对象
open class MyClass { private fun too()=object { var x : String ="x" } fun publictoo()=obje ...
- 图解 HTTP 笔记(七)——HTTPS
本章主要讲解 HTTPS 的基本原理,以及如何利用 HTTPS 防范 HTTP 通信过程中存在的伪装.窃听.篡改等问题 一.HTTP 的缺点 HTTP 在通信过程中会面临以下三种安全问题: 通信使用明 ...
- Java NIO学习笔记八 DatagramChannel
Java NIO DatagramChannel Java NIO DatagramChannel是可以发送和接收UDP数据包的通道.由于UDP是一种无连接网络协议,因此您不能默认读取和写入Datag ...