繁体   English   中英

Spring自动从包中加载上下文文件

[英]Spring automatically loads context file from package

Spring自动从包中加载上下文文件(不添加监听器)。 我无法在web.xml中添加以下侦听器。 如果我添加它们,它会显示错误。有弹簧的任何选项,它会自动扫描包并加载XML。

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

<context-param>
    <param-name>contextConfiglocation</param-name>
    <param-value>
        classpath:com/preprogrammer/recruiterbox/config/dao-context.xml
    </param-value>
</context-param>
<import resource="classpath:applicationContext.xml" />

您可以在servert.xml文件中导入它。

如果您的XML在classpath中可用,那么spring将会处理它。 不需要听众。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM