我想使用Maven denpent项目的spring上下文xml
我有两个项目,每个项目在各自的资源文件夹中都有SpringXML文件 但是一个项目被其他项目引用,比如导入jar我想使用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
如何在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"});
请看我的和。对不起,我不明白你的意思。你能举个例子吗?我已经根据你的问题的猜测更新了答案。如果它没有回答你的问题,请考虑编辑你的问题,以提供更多的信息。