public void validate()

in impl/src/main/java/org/apache/geronimo/config/cdi/ConfigExtension.java [149:193]


    public void validate(@Observes AfterDeploymentValidation add) {
        List<String> deploymentProblems = new ArrayList<>();

        StreamSupport.stream(config.getConfigSources().spliterator(), false)
                     .filter(Reloadable.class::isInstance)
                     .map(Reloadable.class::cast)
                     .forEach(Reloadable::reload);

        if (!hasConfigProxy) {
            configBean.init(config);
        }
        proxyBeans.forEach(b -> b.init(config));
        proxyBeans.clear();

        for (InjectionPoint injectionPoint : injectionPoints) {
            Type type = injectionPoint.getType();

            // replace native types with their Wrapper types
            type = REPLACED_TYPES.getOrDefault(type, type);

            ConfigProperty configProperty = injectionPoint.getAnnotated().getAnnotation(ConfigProperty.class);
            if (type instanceof Class) {
                // a direct injection of a ConfigProperty
                // that means a Converter must exist.
                String key = ConfigInjectionBean.getConfigKey(injectionPoint, configProperty);
                if ((isDefaultUnset(configProperty.defaultValue()))
                        && !config.getOptionalValue(key, (Class) type).isPresent()) {
                    deploymentProblems.add("No Config Value exists for " + key);
                }
            }
        }

        if (!deploymentProblems.isEmpty()) {
            add.addDeploymentProblem(new DeploymentException("Error while validating Configuration\n"
                                                             + String.join("\n", deploymentProblems)));
        }

        if (validProxies.size() != proxies.size()) {
            proxies.stream()
                   .filter(p -> !validProxies.contains(p))
                   .forEach(p -> add.addDeploymentProblem(
                           new DeploymentException("Invalid proxy: " + p + ". All method should have @ConfigProperty.")));
        }
        proxies.clear();
    }