in camel-k-core/support/src/main/java/org/apache/camel/k/support/RuntimeSupport.java [177:208]
public static List<RouteBuilderLifecycleStrategy> loadInterceptors(CamelContext context, Source source) {
ExtendedCamelContext ecc = context.getCamelContextExtension();
List<RouteBuilderLifecycleStrategy> answer = new ArrayList<>();
for (String id : source.getInterceptors()) {
try {
// first check the registry
RouteBuilderLifecycleStrategy interceptor = ecc.getRegistry()
.lookupByNameAndType(id, RouteBuilderLifecycleStrategy.class);
if (interceptor == null) {
// then try with factory finder
interceptor = ecc.getFactoryFinder(Constants.SOURCE_LOADER_INTERCEPTOR_RESOURCE_PATH)
.newInstance(id, RouteBuilderLifecycleStrategy.class)
.orElseThrow(() -> new IllegalArgumentException("Unable to find source loader interceptor for: " + id));
LOGGER.debug("Found source loader interceptor {} from service definition", id);
} else {
LOGGER.debug("Found source loader interceptor {} from registry", id);
}
PropertiesSupport.bindProperties(context, interceptor, Constants.LOADER_INTERCEPTOR_PREFIX + id + ".");
PropertiesSupport.bindProperties(context, interceptor, Constants.LOADER_INTERCEPTOR_PREFIX_FALLBACK + id + ".");
answer.add(interceptor);
} catch (Exception e) {
throw new IllegalArgumentException("Unable to find source loader interceptor for: " + id, e);
}
}
return answer;
}