You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2026/07/04 08:21:42 UTC
(camel) branch feature/CAMEL-23897-runtime-properties-provider created (now 723e7dd1ac86)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch feature/CAMEL-23897-runtime-properties-provider
in repository https://gitbox.apache.org/repos/asf/camel.git
at 723e7dd1ac86 CAMEL-23897: Add RuntimePropertiesProvider SPI for PropertiesDevConsole
This branch includes the following new commits:
new 723e7dd1ac86 CAMEL-23897: Add RuntimePropertiesProvider SPI for PropertiesDevConsole
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(camel) 01/01: CAMEL-23897: Add RuntimePropertiesProvider SPI for PropertiesDevConsole
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch feature/CAMEL-23897-runtime-properties-provider
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 723e7dd1ac867c4cb7d32bff0bbf74eb6869fdb1
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Jul 4 10:12:02 2026 +0200
CAMEL-23897: Add RuntimePropertiesProvider SPI for PropertiesDevConsole
Co-Authored-By: Claude Opus 4.6 <no...@anthropic.com>
Signed-off-by: Claus Ibsen <cl...@gmail.com>
---
.../camel/spi/RuntimePropertiesProvider.java | 48 ++++++++++++++++++++++
.../camel/impl/console/PropertiesDevConsole.java | 45 ++++++++++++++++++++
2 files changed, 93 insertions(+)
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
new file mode 100644
index 000000000000..5e55141c9f6d
--- /dev/null
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/RuntimePropertiesProvider.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spi;
+
+import java.util.Map;
+
+/**
+ * SPI that allows runtimes (Spring Boot, Quarkus, etc.) to contribute application properties for display purposes, such
+ * as the Properties dev console.
+ * <p>
+ * Camel's {@link PropertiesComponent#loadProperties()} only returns properties from Camel's own sources (initial
+ * 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.
+ *
+ * @since 4.22
+ */
+public interface RuntimePropertiesProvider {
+
+ /**
+ * Returns the name of the runtime or source providing these properties (e.g. "Spring Boot", "Quarkus").
+ */
+ String getSource();
+
+ /**
+ * Enumerates application properties from the runtime's configuration system.
+ *
+ * @return a map of property key to value (never null)
+ */
+ Map<String, Object> getProperties();
+}
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 55a3460a7430..c6c8e511a3ec 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
@@ -18,8 +18,10 @@ package org.apache.camel.impl.console;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import org.apache.camel.spi.PropertiesComponent;
+import org.apache.camel.spi.RuntimePropertiesProvider;
import org.apache.camel.spi.annotations.DevConsole;
import org.apache.camel.support.console.AbstractDevConsole;
import org.apache.camel.util.OrderedLocationProperties;
@@ -62,6 +64,27 @@ public class PropertiesDevConsole extends AbstractDevConsole {
}
sb.append("\n");
+ // include properties from runtime providers (Spring Boot, Quarkus, etc.)
+ Set<RuntimePropertiesProvider> providers
+ = getCamelContext().getRegistry().findByType(RuntimePropertiesProvider.class);
+ for (RuntimePropertiesProvider provider : providers) {
+ Map<String, Object> runtimeProps = provider.getProperties();
+ if (runtimeProps != null && !runtimeProps.isEmpty()) {
+ sb.append(String.format("Properties from %s:", provider.getSource()));
+ sb.append("\n");
+ for (var entry : runtimeProps.entrySet()) {
+ String k = entry.getKey();
+ Object v = entry.getValue();
+ if (SensitiveUtils.containsSensitive(k)) {
+ sb.append(String.format(" %s = xxxxxx%n", k));
+ } else {
+ sb.append(String.format(" %s = %s%n", k, v));
+ }
+ }
+ sb.append("\n");
+ }
+ }
+
return sb.toString();
}
@@ -82,6 +105,28 @@ public class PropertiesDevConsole extends AbstractDevConsole {
root.put("properties", arr);
}
+ // include properties from runtime providers (Spring Boot, Quarkus, etc.)
+ Set<RuntimePropertiesProvider> providers
+ = getCamelContext().getRegistry().findByType(RuntimePropertiesProvider.class);
+ for (RuntimePropertiesProvider provider : providers) {
+ Map<String, Object> runtimeProps = provider.getProperties();
+ if (runtimeProps != null && !runtimeProps.isEmpty()) {
+ for (var entry : runtimeProps.entrySet()) {
+ String k = entry.getKey();
+ Object v = entry.getValue();
+ boolean sensitive = SensitiveUtils.containsSensitive(k);
+ JsonObject jo = new JsonObject();
+ jo.put("key", k);
+ jo.put("value", sensitive ? "xxxxxx" : v);
+ jo.put("source", provider.getSource());
+ arr.add(jo);
+ }
+ if (!root.containsKey("properties")) {
+ root.put("properties", arr);
+ }
+ }
+ }
+
return root;
}