Due to another library’s requirements, I must define an ApplicationContext in my main ApplicationContext with a name of default.context:
<?xml version="1.0"?>
<beans>
<bean name="default.context" class="org.springframework.context.support.ClassPathXmlApplicationContext">
<constructor-arg>
<list>
<value>../other-file.xml
</list>
</constructor-arg>
</bean>
<bean class="MyNiceDependency"/>
</beans>
How can I make MyNiceDependency available to the default.context context? I’m assuming I need to use the parent property of ClassPathXmlApplicationContext but how do I inject the current context to it?
Here’s something that should get the job done:
Perhaps there’s something better or, better yet, included with Spring?