public void bindBeansToRegistry()

in extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelRegistryProcessor.java [65:134]


    public void bindBeansToRegistry(
            CamelRecorder recorder,
            CamelConfig camelConfig,
            ApplicationArchivesBuildItem applicationArchives,
            ContainerBeansBuildItem containerBeans,
            CamelRegistryBuildItem registry,
            // CamelContextBuildItem placeholder ensures this build step runs after the CamelContext is created
            CamelContextBuildItem camelContextBuildItem,
            List<CamelBeanBuildItem> registryItems,
            List<CamelServiceFilterBuildItem> serviceFilters,
            List<CamelServicePatternBuildItem> servicePatterns) {

        final ClassLoader TCCL = Thread.currentThread().getContextClassLoader();

        final PathFilter pathFilter = servicePatterns.stream()
                .filter(patterns -> patterns.getDestination() == CamelServiceDestination.REGISTRY)
                .collect(
                        PathFilter.Builder::new,
                        (builder, patterns) -> builder.patterns(patterns.isInclude(), patterns.getPatterns()),
                        PathFilter.Builder::combine)
                .include(camelConfig.service.registry.includePatterns)
                .exclude(camelConfig.service.registry.excludePatterns)
                .build();

        CamelSupport.services(applicationArchives, pathFilter)
                .filter(si -> !containerBeans.getBeans().contains(si))
                .filter(si -> {
                    //
                    // by default all the service found in META-INF/service/org/apache/camel are
                    // bound to the registry but some of the services are then replaced or set
                    // to the camel context directly by extension so it does not make sense to
                    // instantiate them in this phase.
                    //
                    boolean blacklisted = serviceFilters.stream().anyMatch(filter -> filter.getPredicate().test(si));
                    if (blacklisted) {
                        LOGGER.debug("Ignore service: {}", si);
                    }

                    return !blacklisted;
                })
                .forEach(si -> {
                    LOGGER.debug("Binding bean with name: {}, type {}", si.name, si.type);

                    recorder.bind(
                            registry.getRegistry(),
                            si.name,
                            CamelSupport.loadClass(si.type, TCCL));
                });

        registryItems.stream()
                .filter(item -> !containerBeans.getBeans().contains(item))
                .forEach(item -> {
                    LOGGER.debug("Binding bean with name: {}, type {}", item.getName(), item.getType());
                    if (item.getValue().isPresent()) {
                        recorder.bind(
                                registry.getRegistry(),
                                item.getName(),
                                CamelSupport.loadClass(item.getType(), TCCL),
                                item.getValue().get());
                    } else {
                        // the instance of the service will be instantiated by the recorder, this avoid
                        // creating a recorder for trivial services.
                        recorder.bind(
                                registry.getRegistry(),
                                item.getName(),
                                CamelSupport.loadClass(item.getType(), TCCL));
                    }
                });

    }