【问题标题】:What is the best way to read application-context.xml in Spring MVC application, Is it by adding in init-param tag or by adding in context-param tag?在 Spring MVC 应用程序中读取 application-context.xml 的最佳方法是添加 init-param 标签还是添加 context-param 标签?
【发布时间】:2019-09-13 10:47:41
【问题描述】:

在少数应用程序中,我看到通过 init-param 读取应用程序上下文文件,在少数应用程序中通过 context-param 读取。我的目的是知道何时使用哪一个。

【问题讨论】:

    标签: spring spring-mvc applicationcontext


    【解决方案1】:

    毕竟这取决于你的项目需求

    1) 如果你想设置数据的访问范围,那么使用 。如果你声明里面的任何东西只能被那个特定的 servlet 访问。 init-param 在 标记内声明。

    2) 如果您想访问整个应用程序中的数据或应用程序中的任何位置,那么您必须使用

    如果您同意,请点击向上箭头按钮

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-01-05
      • 2013-08-09
      • 2014-01-22
      • 2017-05-04
      • 2010-09-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多