I have two spring application contexts. One is local to my application and the other is from one of the maven dependencies.
Now, my applicationContext.xml file look like this.
<import resource="classpath*:**/sample-applicationContext.xml" />
and I have <context:component-scan>
in the sample-applicationContext.xml
file which scans for components.
and Now, when I do the following..
ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationContext.xml");
MyClass m=ctx.getBean(MyClass.class);
Unfortunately, when I get the MyClass
object, the object is created however, I see that dependencies in MyClass
are not injected.
The dependencies autowired in MyClass
are the beans that are scanned using the <context:component-scan>
in sample-applicationContext.xml
file.
Is there any way to make use of multiple application contexts present in the Maven dependencies and autowire beans in them in my project classes?