我们什么时候在Spring中使用applicationContext.xml? [英] When will we use applicationContext.xml in Spring?

查看:396
本文介绍了我们什么时候在Spring中使用applicationContext.xml?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我们在Spring需要 applicationContext.xml

Why do we need applicationContext.xml in Spring?

我们会在什么情况下使用它?你有一个例子吗?

In what situation would we use it? Do you have an example?

applicationContext.xml 春天有什么区别-servlet.xml

我们如何在Spring中比较 applicationContext.xml Struts中的 Struts.xml 是为了便于理解?

How can we compare applicationContext.xml in Spring with Struts.xml in Struts for easy understanding?

推荐答案

为什么我们在Spring中需要applicationContext.xml?

在Spring框架的早期,Application上下文,即bootstrap所需的各种编织和设置,坐标并使用XML文件控制所有对象。虽然可以将各种设置和依赖注入分解为多个上下文文件,但是在Spring 2.5及更高版本中,通过注释驱动设置可以更轻松地完成此过程。

In the early days of Spring framework, Application context i.e the various weave and settings necessary to bootstrap, coordinate and control all objects, where done using XML file. Although one can break various settings and dependency injection into several context files, this process has been made easier In Spring 2.5 and later by annotation-driven settings.

什么applicationContext.xml和spring-servlet.xml之间的区别是什么?

在一个基于MVC的项目中,如果你没有使用注释驱动的编织在您的项目机制中,可以在spring-servlet.xml中设置所有端点servlet。请注意,文件的名称始终是自己选择的。

In a MVC based project, again if you're not using annotation-driven weaving mechanism for your project, all your endpoint servlets can be setup in the spring-servlet.xml. Note that the name of the file is always self chosen.

我们如何将Spring中的applicationContext.xml与Struts中的Struts.xml进行比较以便于理解?

他们在尝试实现的目标方面都很相似。即应用程序引导程序设置的中心位置。同样,所有设置都可以分层到不同的文件中,使其模块化。

They are both similar in terms of what they're trying to achieve. i.e a central location for the application bootstrap settings. Similarly, all settings can be tiered into different files to make it modular.

这篇关于我们什么时候在Spring中使用applicationContext.xml?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆