/** * Destroy an {@link IntegrationFlow} bean (as well as all its dependant beans) * for provided {@code flowId} and clean up all the local cache for it. * @param flowId the bean name to destroy from */ @Override public void remove(String flowId) { if (this.registry.containsKey(flowId)) { IntegrationFlowRegistration flowRegistration = this.registry.remove(flowId); flowRegistration.stop(); removeDependantBeans(flowId); this.beanDefinitionRegistry.removeBeanDefinition(flowId); } else { throw new IllegalStateException("An IntegrationFlow with the id " + "[" + flowId + "] doesn't exist in the registry."); } }
private void removeDependantBeans(String parentName) { String[] dependentBeans = this.beanFactory.getDependentBeans(parentName); for (String beanName : dependentBeans) { removeDependantBeans(beanName); this.beanDefinitionRegistry.removeBeanDefinition(beanName); // TODO until https://jira.spring.io/browse/SPR-16837 String[] aliases = this.beanDefinitionRegistry.getAliases(beanName); for (String alias : aliases) { this.beanDefinitionRegistry.removeAlias(alias); } } }
/** * Destroy an {@link IntegrationFlow} bean (as well as all its dependant beans) * for provided {@code flowId} and clean up all the local cache for it. * @param flowId the bean name to destroy from */ @Override public void remove(String flowId) { if (this.registry.containsKey(flowId)) { IntegrationFlowRegistration flowRegistration = this.registry.remove(flowId); flowRegistration.stop(); removeDependantBeans(flowId); this.beanDefinitionRegistry.removeBeanDefinition(flowId); } else { throw new IllegalStateException("An IntegrationFlow with the id " + "[" + flowId + "] doesn't exist in the registry."); } }
private void removeDependantBeans(String parentName) { String[] dependentBeans = this.beanFactory.getDependentBeans(parentName); for (String beanName : dependentBeans) { removeDependantBeans(beanName); this.beanDefinitionRegistry.removeBeanDefinition(beanName); // TODO until https://jira.spring.io/browse/SPR-16837 String[] aliases = this.beanDefinitionRegistry.getAliases(beanName); for (String alias : aliases) { this.beanDefinitionRegistry.removeAlias(alias); } } }