class Flow2Config {

    @Bean
    public Map<String, FlowConfiguration<?>> flowConfigurationMap(List<FlowConfiguration<?>> flowConfigs) {
        Map<String, FlowConfiguration<?>> flowConfigMap = new HashMap<>();
        for (FlowConfiguration<?> flowConfig : flowConfigs) {
            for (FlowEvent event : flowConfig.getInitEvents()) {
                String key = event.event();
                if (flowConfigMap.get(key) != null) {
                    throw new UnsupportedOperationException("Event already registered: " + key);
                }
                flowConfigMap.put(key, flowConfig);
            }
        }
        return ImmutableMap.copyOf(flowConfigMap);
    }

}