class ComponentContextRefreshInterceptor implements ContextRefreshInterceptor {

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

    private final ComponentManager   componentManager;

    private final SofaRuntimeContext sofaRuntimeContext;                                              ;

    public ComponentContextRefreshInterceptor(SofaRuntimeManager sofaRuntimeManager) {
        this.componentManager = sofaRuntimeManager.getComponentManager();
        this.sofaRuntimeContext = sofaRuntimeManager.getSofaRuntimeContext();
    }

    @Override
    public void afterRefresh(SofaGenericApplicationContext context, Throwable throwable) {<FILL_FUNCTION_BODY>}
}

        if (throwable == null) {
            ComponentName componentName = ComponentNameFactory.createComponentName(
                SpringContextComponent.SPRING_COMPONENT_TYPE, context.getId());
            Implementation implementation = new SpringContextImplementation(context);
            ComponentInfo componentInfo = new SpringContextComponent(componentName, implementation,
                sofaRuntimeContext);
            componentManager.register(componentInfo);
        } else {
            Collection<ComponentInfo> componentInfos = componentManager
                .getComponentInfosByApplicationContext(context);
            for (ComponentInfo componentInfo : componentInfos) {
                try {
                    componentManager.unregister(componentInfo);
                } catch (ServiceRuntimeException e) {
                    LOGGER.error(ErrorCode.convert("01-03001", componentInfo.getName()), e);
                }
            }
        }
    
<no_super_class>