This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-4.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.22.x by this push:
new e6468a0cd857 PropertiesDevConsole: use RuntimePropertiesProvider as
authoritative source
e6468a0cd857 is described below
commit e6468a0cd857b5d6c1678c256a1031810fdda8d6
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Aug 13 15:21:32 2026 +0200
PropertiesDevConsole: use RuntimePropertiesProvider as authoritative source
When a RuntimePropertiesProvider is present (Spring Boot, Quarkus, etc.)
use it as the sole property source instead of combining it with
pc.loadProperties(). This avoids noisy duplicates from runtime-managed
config sources like environment variables and system properties.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: Claus Ibsen <[email protected]>
---
.../camel/spi/RuntimePropertiesProvider.java | 8 +-
.../camel/impl/console/PropertiesDevConsole.java | 105 +++++++++++----------
2 files changed, 61 insertions(+), 52 deletions(-)
diff --git
a/core/camel-api/src/main/java/org/apache/camel/spi/RuntimePropertiesProvider.java
b/core/camel-api/src/main/java/org/apache/camel/spi/RuntimePropertiesProvider.java
index 1f37b088e67d..e1c1abe6af5f 100644
---
a/core/camel-api/src/main/java/org/apache/camel/spi/RuntimePropertiesProvider.java
+++
b/core/camel-api/src/main/java/org/apache/camel/spi/RuntimePropertiesProvider.java
@@ -26,9 +26,11 @@ import java.util.Collection;
* properties, .properties files, override properties). Application properties
managed by external configuration systems
* (e.g. Spring {@code Environment}, SmallRye {@code Config}) are not included.
* <p>
- * This SPI bridges that gap: runtimes register an implementation that
enumerates their properties, and the dev console
- * merges them with the Camel-managed properties. The properties returned by
this SPI are read-only and are NOT used for
- * placeholder resolution — they are purely for display and introspection.
+ * This SPI bridges that gap: runtimes register an implementation that
enumerates their properties. When a provider is
+ * present, the dev console uses it as the authoritative source instead of
{@link PropertiesComponent#loadProperties()},
+ * avoiding noisy duplicates from runtime-managed config sources (environment
variables, system properties, etc.). The
+ * properties returned by this SPI are read-only and are NOT used for
placeholder resolution — they are purely for
+ * display and introspection.
*
* @since 4.22
*/
diff --git
a/core/camel-console/src/main/java/org/apache/camel/impl/console/PropertiesDevConsole.java
b/core/camel-console/src/main/java/org/apache/camel/impl/console/PropertiesDevConsole.java
index 8d243f773e50..9784b7652b45 100644
---
a/core/camel-console/src/main/java/org/apache/camel/impl/console/PropertiesDevConsole.java
+++
b/core/camel-console/src/main/java/org/apache/camel/impl/console/PropertiesDevConsole.java
@@ -48,38 +48,42 @@ public class PropertiesDevConsole extends
AbstractDevConsole {
sb.append(String.format("Properties loaded from locations: %s", loc));
sb.append("\n");
- Properties p = pc.loadProperties();
- OrderedLocationProperties olp = null;
- if (p instanceof OrderedLocationProperties orderedlocationproperties2)
{
- olp = orderedlocationproperties2;
- }
- for (var entry : p.entrySet()) {
- String k = entry.getKey().toString();
- Object v = entry.getValue();
- loc = olp != null ? locationSummary(olp, k) : null;
- if (SensitiveUtils.containsSensitive(k)) {
- sb.append(String.format(" %s %s = xxxxxx%n", loc, k));
- } else {
- sb.append(String.format(" %s %s = %s%n", loc, k, v));
- }
- }
- sb.append("\n");
-
- // include properties from runtime providers (Spring Boot, Quarkus,
etc.)
+ // when a runtime provider is present (Spring Boot, Quarkus, etc.) it
is the
+ // authoritative source — skip pc.loadProperties() to avoid noisy
duplicates
+ // from runtime-managed config sources (env vars, system properties,
etc.)
Set<RuntimePropertiesProvider> providers
=
getCamelContext().getRegistry().findByType(RuntimePropertiesProvider.class);
- for (RuntimePropertiesProvider provider : providers) {
- Collection<RuntimePropertiesProvider.Property> runtimeProps =
provider.getProperties();
- if (runtimeProps != null && !runtimeProps.isEmpty()) {
- for (RuntimePropertiesProvider.Property prop : runtimeProps) {
- if (SensitiveUtils.containsSensitive(prop.key())) {
- sb.append(String.format(" %s %s = xxxxxx%n",
prop.source(), prop.key()));
- } else {
- sb.append(String.format(" %s %s = %s%n",
prop.source(), prop.key(), prop.value()));
+ if (!providers.isEmpty()) {
+ for (RuntimePropertiesProvider provider : providers) {
+ Collection<RuntimePropertiesProvider.Property> runtimeProps =
provider.getProperties();
+ if (runtimeProps != null && !runtimeProps.isEmpty()) {
+ for (RuntimePropertiesProvider.Property prop :
runtimeProps) {
+ if (SensitiveUtils.containsSensitive(prop.key())) {
+ sb.append(String.format(" %s %s = xxxxxx%n",
prop.source(), prop.key()));
+ } else {
+ sb.append(String.format(" %s %s = %s%n",
prop.source(), prop.key(), prop.value()));
+ }
}
+ sb.append("\n");
}
- sb.append("\n");
}
+ } else {
+ Properties p = pc.loadProperties();
+ OrderedLocationProperties olp = null;
+ if (p instanceof OrderedLocationProperties
orderedlocationproperties2) {
+ olp = orderedlocationproperties2;
+ }
+ for (var entry : p.entrySet()) {
+ String k = entry.getKey().toString();
+ Object v = entry.getValue();
+ loc = olp != null ? locationSummary(olp, k) : null;
+ if (SensitiveUtils.containsSensitive(k)) {
+ sb.append(String.format(" %s %s = xxxxxx%n", loc, k));
+ } else {
+ sb.append(String.format(" %s %s = %s%n", loc, k, v));
+ }
+ }
+ sb.append("\n");
}
return sb.toString();
@@ -93,33 +97,36 @@ public class PropertiesDevConsole extends
AbstractDevConsole {
root.put("locations", pc.getLocations());
JsonArray arr = new JsonArray();
- Properties p = pc.loadProperties();
- OrderedLocationProperties olp = p instanceof OrderedLocationProperties
o ? o : null;
- for (var entry : p.entrySet()) {
- arr.add(toPropertyJson(pc, olp, entry));
- }
- if (!arr.isEmpty()) {
- root.put("properties", arr);
- }
- // include properties from runtime providers (Spring Boot, Quarkus,
etc.)
+ // when a runtime provider is present (Spring Boot, Quarkus, etc.) it
is the
+ // authoritative source — skip pc.loadProperties() to avoid noisy
duplicates
+ // from runtime-managed config sources (env vars, system properties,
etc.)
Set<RuntimePropertiesProvider> providers
=
getCamelContext().getRegistry().findByType(RuntimePropertiesProvider.class);
- for (RuntimePropertiesProvider provider : providers) {
- Collection<RuntimePropertiesProvider.Property> runtimeProps =
provider.getProperties();
- if (runtimeProps != null && !runtimeProps.isEmpty()) {
- for (RuntimePropertiesProvider.Property prop : runtimeProps) {
- boolean sensitive =
SensitiveUtils.containsSensitive(prop.key());
- JsonObject jo = new JsonObject();
- jo.put("key", prop.key());
- jo.put("value", sensitive ? "xxxxxx" : prop.value());
- jo.put("source", prop.source());
- arr.add(jo);
- }
- if (!root.containsKey("properties")) {
- root.put("properties", arr);
+ if (!providers.isEmpty()) {
+ for (RuntimePropertiesProvider provider : providers) {
+ Collection<RuntimePropertiesProvider.Property> runtimeProps =
provider.getProperties();
+ if (runtimeProps != null && !runtimeProps.isEmpty()) {
+ for (RuntimePropertiesProvider.Property prop :
runtimeProps) {
+ boolean sensitive =
SensitiveUtils.containsSensitive(prop.key());
+ JsonObject jo = new JsonObject();
+ jo.put("key", prop.key());
+ jo.put("value", sensitive ? "xxxxxx" : prop.value());
+ jo.put("source", prop.source());
+ arr.add(jo);
+ }
}
}
+ } else {
+ Properties p = pc.loadProperties();
+ OrderedLocationProperties olp = p instanceof
OrderedLocationProperties o ? o : null;
+ for (var entry : p.entrySet()) {
+ arr.add(toPropertyJson(pc, olp, entry));
+ }
+ }
+
+ if (!arr.isEmpty()) {
+ root.put("properties", arr);
}
return root;