Spring Context配置

时间:2012-07-17 09:09:53

标签: spring spring-mvc applicationcontext configurationsection

我创建了一个spring MVC应用程序。我正在研究弹簧安全概念。所以我创建了一个上下文配置文件名webbsite-security.xml,我在上下文配置路径中给出了相同的文件位置。由于说明FILENOTFOUNDEXCEPTION(找不到applicationContext.xml)的异常,应用程序失败。即使我们使用其他一些配置文件,是否还必须退出名为applicationContext.xml的文件。

1 个答案:

答案 0 :(得分:1)

为什么你要把它称之为别的东西,它会违背默认的标准弹簧方式做事。只需将相关配置文件导入默认的应用程序上下文xml即可。

但是如果你想要改变它,你必须在web.xml中指定以下内容:

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/whatevever.xml</param-value>
</context-param> 

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>