Spring 3 @ImportResource包含多个文件 [英] Spring 3 @ImportResource with multiple files
本文介绍了Spring 3 @ImportResource包含多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用Spring 3 @ImportResource注释找到导入多个spring xml上下文文件的语法。
I'm trying to find the syntax for importing multiple spring xml context files using Spring 3 @ImportResource annotation.
我尝试使用逗号将文件名分隔为如下所示,但不起作用:
I have tried using comma to separate the filenames as illustrated below but that does not work:
@Configuration
@ImportResource("spring-context1.xml", "spring-context2.xml")
public class ConfigClass { }
@ImportResource的文档说表示一个或更多资源,包含要导入的bean定义。所以我认为应该有一种方法来指定多个上下文文件。令人惊讶的是,我无法在Google上找到任何示例
The doc for @ImportResource says "Indicates one or more resources containing bean definitions to import." so I believe there should be a way to specify multiple context files. Surprisingly, I've not been able to find any example on Google
推荐答案
尝试:
@Configuration
@ImportResource( { "spring-context1.xml", "spring-context2.xml" } )
public class ConfigClass { }
这篇关于Spring 3 @ImportResource包含多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文