class DynamicSpringContextLoader implements SpringContextLoader, InitializingBean,
                                       StartupReporterAware {

    private static final Logger                    LOGGER                     = SofaBootLoggerFactory
                                                                                  .getLogger(DynamicSpringContextLoader.class);

    protected final ConfigurableApplicationContext rootApplicationContext;

    private boolean                                allowBeanOverriding;

    private List<String>                           activeProfiles             = new ArrayList<>();

    private List<ContextRefreshInterceptor>        contextRefreshInterceptors = new ArrayList<>();

    private boolean                                publishEventToParent;

    private SofaPostProcessorShareManager          sofaPostProcessorShareManager;

    private StartupReporter                        startupReporter;

    public DynamicSpringContextLoader(ApplicationContext rootApplicationContext) {
        this.rootApplicationContext = (ConfigurableApplicationContext) rootApplicationContext;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        Assert.notNull(rootApplicationContext, "rootApplicationContext must not be null");
        Assert.isInstanceOf(ConfigurableApplicationContext.class, rootApplicationContext,
            "rootApplicationContext must be ConfigurableApplicationContext");
    }

    @Override
    public void loadSpringContext(DeploymentDescriptor deployment,
                                  ApplicationRuntimeModel application) {
        ClassLoader classLoader = deployment.getClassLoader();

        SofaDefaultListableBeanFactory beanFactory = SofaSpringContextSupport.createBeanFactory(classLoader, this::createBeanFactory);
        beanFactory.setId(deployment.getModuleName());

        SofaGenericApplicationContext context = SofaSpringContextSupport.createApplicationContext(beanFactory, this::createApplicationContext);
        if (startupReporter != null) {
            BufferingApplicationStartup bufferingApplicationStartup = new BufferingApplicationStartup(startupReporter.getBufferSize());
            context.setApplicationStartup(bufferingApplicationStartup);
        }

        context.setId(deployment.getModuleName());
        if (!CollectionUtils.isEmpty(activeProfiles)) {
            context.getEnvironment().setActiveProfiles(StringUtils.toStringArray(activeProfiles));
        }
        context.setAllowBeanDefinitionOverriding(allowBeanOverriding);
        context.setPublishEventToParent(publishEventToParent);

        if (!CollectionUtils.isEmpty(contextRefreshInterceptors)) {
            contextRefreshInterceptors.sort(AnnotationAwareOrderComparator.INSTANCE);
            context.setInterceptors(contextRefreshInterceptors);
        }

        ConfigurableApplicationContext parentContext = getSpringParentContext(deployment, application);
        context.setParent(parentContext);
        context.getEnvironment().setConversionService(parentContext.getEnvironment().getConversionService());

        XmlBeanDefinitionReader beanDefinitionReader = createXmlBeanDefinitionReader(context);
        beanDefinitionReader.setNamespaceAware(true);
        beanDefinitionReader.setBeanClassLoader(classLoader);
        beanDefinitionReader.setResourceLoader(context);

        loadBeanDefinitions(deployment, beanDefinitionReader);
        deployment.setApplicationContext(context);
        addPostProcessors(beanFactory);
    }

    protected XmlBeanDefinitionReader createXmlBeanDefinitionReader(SofaGenericApplicationContext context) {
        XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(context);
        beanDefinitionReader.setValidating(true);
        return beanDefinitionReader;
    }

    protected SofaDefaultListableBeanFactory createBeanFactory() {
        return new SofaDefaultListableBeanFactory();
    }

    protected SofaGenericApplicationContext createApplicationContext(SofaDefaultListableBeanFactory beanFactory) {
        return new SofaGenericApplicationContext(beanFactory);
    }

    protected ConfigurableApplicationContext getSpringParentContext(DeploymentDescriptor deployment,
                                                                    ApplicationRuntimeModel application) {
        ConfigurableApplicationContext parentSpringContext = null;
        if (deployment.getSpringParent() != null) {
            String springParent = deployment.getSpringParent();

            if (StringUtils.hasText(springParent)) {
                DeploymentDescriptor parent = application.getDeploymentByName(springParent);
                if (parent != null) {
                    parentSpringContext = (ConfigurableApplicationContext) parent
                        .getApplicationContext();
                    if (parentSpringContext == null) {
                        LOGGER.warn("Module [{}]'s Spring-Parent [{}] is Null!",
                            deployment.getModuleName(), springParent);
                    }
                }
            }
        }
        return parentSpringContext == null ? rootApplicationContext : parentSpringContext;
    }

    protected void loadBeanDefinitions(DeploymentDescriptor deployment,
                                       BeanDefinitionReader beanDefinitionReader) {<FILL_FUNCTION_BODY>}

    protected void addPostProcessors(SofaDefaultListableBeanFactory beanFactory) {
        if (sofaPostProcessorShareManager != null) {
            sofaPostProcessorShareManager.getRegisterSingletonMap().forEach((beanName, singletonObject) -> {
                if (!beanFactory.containsBeanDefinition(beanName)) {
                    beanFactory.registerSingleton(beanName, singletonObject);
                }
            });
            sofaPostProcessorShareManager.getRegisterBeanDefinitionMap().forEach((beanName, beanDefinition) -> {
                if (!beanFactory.containsBeanDefinition(beanName)) {
                    beanFactory.registerBeanDefinition(beanName, beanDefinition);
                }
            });
        }
    }

    public boolean isAllowBeanOverriding() {
        return allowBeanOverriding;
    }

    public void setAllowBeanOverriding(boolean allowBeanOverriding) {
        this.allowBeanOverriding = allowBeanOverriding;
    }

    public List<String> getActiveProfiles() {
        return activeProfiles;
    }

    public void setActiveProfiles(List<String> activeProfiles) {
        this.activeProfiles = activeProfiles;
    }

    public boolean isPublishEventToParent() {
        return publishEventToParent;
    }

    public void setPublishEventToParent(boolean publishEventToParent) {
        this.publishEventToParent = publishEventToParent;
    }

    public List<ContextRefreshInterceptor> getContextRefreshInterceptors() {
        return contextRefreshInterceptors;
    }

    public void setContextRefreshInterceptors(List<ContextRefreshInterceptor> contextRefreshInterceptors) {
        this.contextRefreshInterceptors = contextRefreshInterceptors;
    }

    public SofaPostProcessorShareManager getSofaPostProcessorShareManager() {
        return sofaPostProcessorShareManager;
    }

    public void setSofaPostProcessorShareManager(SofaPostProcessorShareManager sofaPostProcessorShareManager) {
        this.sofaPostProcessorShareManager = sofaPostProcessorShareManager;
    }

    @Override
    public void setStartupReporter(StartupReporter startupReporter) throws BeansException {
        this.startupReporter = startupReporter;
    }
}

        if (deployment.getSpringResources() != null) {
            for (Map.Entry<String, Resource> entry : deployment.getSpringResources().entrySet()) {
                String fileName = entry.getKey();
                beanDefinitionReader.loadBeanDefinitions(entry.getValue());
                deployment.addInstalledSpringXml(fileName);
            }
        }
    
<no_super_class>