in camel-k-core/support/src/main/java/org/apache/camel/k/support/PropertiesSupport.java [50:90]
public static <T> T bindProperties(CamelContext context, T target, Predicate<String> filter, String prefix, boolean stripPrefix) {
final PropertiesComponent component = context.getPropertiesComponent();
final Properties propertiesWithPrefix = component.loadProperties(filter);
final Map<String, Object> properties = new HashMap<>();
propertiesWithPrefix.stringPropertyNames().forEach(
name -> properties.put(
stripPrefix ? name.substring(prefix.length()) : name,
propertiesWithPrefix.getProperty(name))
);
PropertyConfigurer configurer = null;
if (target instanceof Component) {
// the component needs to be initialized to have the configurer ready
ServiceHelper.initService(target);
configurer = ((Component) target).getComponentPropertyConfigurer();
}
if (configurer == null) {
String name = target.getClass().getName();
if (target instanceof ExtendedCamelContext) {
// special for camel context itself as we have an extended configurer
name = ExtendedCamelContext.class.getName();
}
// see if there is a configurer for it
configurer = PluginHelper.getConfigurerResolver(context.getCamelContextExtension()).resolvePropertyConfigurer(name, context);
}
PropertyBindingSupport.build()
.withIgnoreCase(true)
.withCamelContext(context)
.withTarget(target)
.withProperties(properties)
.withRemoveParameters(true)
.withOptionPrefix(stripPrefix ? null : prefix)
.withConfigurer(configurer)
.bind();
return target;
}