【问题标题】:Spring config file naming conventionSpring 配置文件命名约定
【发布时间】:2023-03-07 11:24:02
【问题描述】:

Spring 中的命名约定实际上是什么,即配置文件必须具有名称“servletname-.xml”。
如果名字不同,会不会不行?

这如何与我们可以有一个名称的事实相协调:spring-config.xml 并使用 new ClassPathXmlApplicationContext("spring-config.xml") 加载它。这里似乎不需要遵循命名约定

【问题讨论】:

    标签: spring


    【解决方案1】:

    约定就是这样:约定。它在FrameworkServlet 中定义,(流行的)DispatcherServlet 建立在该FrameworkServlet 上。您可以通过设置 contextConfigLocation 参数来更改位置。

    【讨论】:

      猜你喜欢
      • 2010-11-26
      • 2015-08-26
      • 1970-01-01
      • 2020-04-01
      • 2011-08-08
      • 1970-01-01
      • 2010-09-22
      • 1970-01-01
      • 2011-01-11
      相关资源
      最近更新 更多