Spring ClasspathXmlApplicationContext与当前ApplicationContext的父级?

Spring ClasspathXmlApplicationContext与当前ApplicationContext的父级?,spring,spring-3,Spring,Spring 3,由于另一个库的要求,我必须在我的主ApplicationContext中定义一个名为default.context的ApplicationContext: <?xml version="1.0"?> <beans> <bean name="default.context" class="org.springframework.context.support.ClassPathXmlApplicationContext"> <con

由于另一个库的要求,我必须在我的主
ApplicationContext
中定义一个名为
default.context的
ApplicationContext

<?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>

../other-file.xml

如何使
MyNiceDependency
可用于
default.context
上下文?我假设我需要使用
ClassPathXmlApplicationContext
parent
属性,但如何将当前上下文注入其中?

以下是一些应该完成工作的内容:

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class ThisApplicationContextFactoryBean implements FactoryBean<ApplicationContext>,
        ApplicationContextAware {

    private ApplicationContext applicationContext;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext)
            throws BeansException {
        this.applicationContext = applicationContext;
    }

    public ApplicationContext getApplicationContext() {
        return this.applicationContext;
    }

    @Override
    public ApplicationContext getObject() throws Exception {
        return getApplicationContext();
    }

    @Override
    public Class<?> getObjectType() {
        return ApplicationContext.class;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }
}
import org.springframework.beans.BeansException;
导入org.springframework.beans.factory.FactoryBean;
导入org.springframework.context.ApplicationContext;
导入org.springframework.context.ApplicationContextAware;
公共类ThisApplicationContextFactoryBean实现FactoryBean,
ApplicationContextAware{
私有应用程序上下文应用程序上下文;
@凌驾
public void setApplicationContext(ApplicationContext ApplicationContext)
抛出BeansException{
this.applicationContext=applicationContext;
}
公共应用程序上下文getApplicationContext(){
返回this.applicationContext;
}
@凌驾
公共应用程序上下文getObject()引发异常{
返回getApplicationContext();
}
@凌驾
公共类getObjectType(){
返回ApplicationContext.class;
}
@凌驾
公共布尔isSingleton(){
返回true;
}
}
也许春天里有更好的东西,或者更好的东西