class TemplatingCustomizer implements CamelKIntegrationCustomizer {

    @Override
    public Integration customize(IntegrationDeployment deployment, Integration integration, EnumSet<Exposure> exposure) {
        Set<TemplateStepLanguage> languages = deployment.getSpec().getFlows().stream()
            .flatMap(f -> f.getSteps().stream())
            .filter(s -> s.getStepKind() == StepKind.template)
            .flatMap(s -> asStream(Optional.of(s.getConfiguredProperties().get("language"))))
            .map(TemplateStepLanguage::stepLanguage)
            .collect(Collectors.toSet());

        if (!languages.isEmpty()) {
            IntegrationSpec.Builder spec = new IntegrationSpec.Builder();
            if (integration.getSpec() != null) {
                spec = spec.from(integration.getSpec());
            }

            for (TemplateStepLanguage lan : languages) {
                spec = spec.addDependencies("mvn:" + lan.mavenDependency());
            }

            integration.setSpec(spec.build());
        }
        return integration;
    }

}