private static <COMPONENT extends ChainedComponent> void instantiateChains(
            ComponentRegistry<Chain<COMPONENT>> chainRegistry,
            ChainsModel model,
            ComponentRegistry<COMPONENT> allComponents) {

        for (ChainSpecification chain : model.allChainsFlattened()) {
            try {
                Chain<COMPONENT> componentChain = new Chain<>(chain.componentId,
                        resolveComponents(chain.componentReferences, allComponents),
                        chain.phases());
                chainRegistry.register(chain.componentId, componentChain);
            } catch (Exception e) {
                throw new ConfigurationRuntimeException("Invalid chain '" + chain.componentId + "'", e);
            }
        }
    }
Configures a registry of chains.

@author bratseth
@author gjoranv
container-core/src/main/java/com/yahoo/component/chain/ChainsConfigurer.java