读取Spring配置文件

来源:互联网 发布:淘宝客服用语 物流慢 编辑:程序博客网 时间:2024/05/16 04:01

在最近的项目中,web.xml中读取Spring的配置文件applicationContext.xml文件如下:

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

而applicationContext.xml中又引入了项目中各模块独自配置的spring配置文件,如:

<import resource="classpath:com/wfzcx/salary/sys/sys-context.xml" />
<import resource="classpath:com/wfzcx/salary/query/sys-context_query.xml" />
<import resource="classpath:com/wfzcx/salary/biz/transaction/agencyinfo/sys-context_agencyhurs.xml" />
<import resource="classpath:com/wfzcx/salary/monthEnd/sys-context_monthEnd.xml" />

这样就解释了为何可以读取到各个模块下独立配置的spring配置文件。

0 0