Class PropertyPlaceholderResolver
Resolves Apache Camel-style property placeholders inside a string — typically an endpoint URI —
at route-compile time. Supports {{key}} (required) and {{key:default}} (with a fallback
value). This is the redb.Route analogue of Camel's PropertiesComponent: it lets endpoint URIs
(and any other DSL string routed through it) externalise their configuration instead of hard-coding
hosts, queue names, ports or paths.
The value lookup is supplied by the caller as a , keeping this type pure
and testable. wires the lookup to IConfiguration (which already layers
environment variables, appsettings and user-secrets with the container's own precedence — so no
Camel-style env:/sys: prefix functions are needed) and, as a container-free fallback,
the context's own properties.
Deliberately minimal: no nested placeholders ({{a{{b}}}}), no optional-parameter removal
({{?key}}), no encryption or multi-location precedence. Resolution is single-pass, so it can
never loop. A placeholder with neither a value nor a default fails fast at compile time.
public static class PropertyPlaceholderResolver
Inheritance
Methods
HasPlaceholder(string?)
Fast pre-check: true only if text could contain a placeholder. Lets callers
public static bool HasPlaceholder(string? text)
Resolve(string, Func<string, string?>)
Replaces every {{key}} / {{key:default}} in text with the value
public static string Resolve(string text, Func<string, string?> lookup)