I want to run main() loading spring context xml with another project's xml & source

4.1k views Asked by At

I have to two java projects. One is a main and the other is imported project to the main. Using Maven, I load both project's spring context xml. But If I want to execute below in the main project But, this source can't load imported project's xml. please help me. I want to load the other project's spring context xml and source.

public static void main(String[] args) {
    @SuppressWarnings("unused")
    ApplicationContext context= new ClassPathXmlApplicationContext("/spring/context-*.xml");
}
1

There are 1 answers

0
artbristol On BEST ANSWER

I don't think you can use * in that particular path. You need to explicitly specify the context files, e.g.

ApplicationContext context= new ClassPathXmlApplicationContext(
    "/spring/context-a.xml",
    "/spring/context-b.xml");