Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我想使用Maven denpent项目的spring上下文xml_Xml_Spring_Maven - Fatal编程技术网

我想使用Maven denpent项目的spring上下文xml

我想使用Maven denpent项目的spring上下文xml,xml,spring,maven,Xml,Spring,Maven,我有两个项目,每个项目在各自的资源文件夹中都有SpringXML文件 但是一个项目被其他项目引用,比如导入jar 如何在jar中使用XML 您可以使用classpath*:/application context.xml-用文件名替换application context.xml 如果您的SpringXML文件名为applicationon-context.XML,请将其移动到两个项目中的Spring文件夹下。然后,您可以创建一个包含两个XML文件的上下文,如下所示 ApplicationCon

我有两个项目,每个项目在各自的资源文件夹中都有SpringXML文件

但是一个项目被其他项目引用,比如导入jar


如何在jar中使用XML

您可以使用
classpath*:/application context.xml
-用文件名替换
application context.xml

如果您的SpringXML文件名为applicationon-context.XML,请将其移动到两个项目中的Spring文件夹下。然后,您可以创建一个包含两个XML文件的上下文,如下所示

ApplicationContext ctx = new ClasspathXmlApplicationContext("classpath*:/spring/application-context.xml")

您可以使用jar中的xml和项目中的xml:

ApplicationContext context = new ClassPathXmlApplicationContext( new String[] {
                "classpath*:spring/applicationContext-*.xml"});

请看我的和。

对不起,我不明白你的意思。你能举个例子吗?我已经根据你的问题的猜测更新了答案。如果它没有回答你的问题,请考虑编辑你的问题,以提供更多的信息。