This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 0c219a62604c CAMEL-23897: Add RuntimePropertiesProvider SPI for 
PropertiesDevConsole (#24413)
0c219a62604c is described below

commit 0c219a62604c2c9bf7f21869e211f1f65c94095f
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Jul 4 13:32:22 2026 +0200

    CAMEL-23897: Add RuntimePropertiesProvider SPI for PropertiesDevConsole 
(#24413)
    
    * CAMEL-23897: Add RuntimePropertiesProvider SPI for PropertiesDevConsole
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
    
    * CAMEL-23897: Per-property source in RuntimePropertiesProvider SPI
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
    
    ---------
    
    Signed-off-by: Claus Ibsen <[email protected]>
    Co-authored-by: Claude Opus 4.6 <[email protected]>
---
 .../camel/spi/RuntimePropertiesProvider.java       | 54 ++++++++++++++++++++++
 .../camel/impl/console/PropertiesDevConsole.java   | 40 ++++++++++++++++
 2 files changed, 94 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..1f37b088e67d
--- /dev/null
+++ 
b/core/camel-api/src/main/java/org/apache/camel/spi/RuntimePropertiesProvider.java
@@ -0,0 +1,54 @@
+/*
+ * 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.Collection;
+
+/**
+ * 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 {
+
+    /**
+     * A single property with its key, value, and the source it came from.
+     *
+     * @param key    the property key
+     * @param value  the property value
+     * @param source the source (e.g. "Spring Boot", "ENV", "JVM")
+     * @since        4.22
+     */
+    record Property(String key, Object value, String source) {
+    }
+
+    /**
+     * Enumerates application properties from the runtime's configuration 
system.
+     *
+     * @return a collection of properties with their sources (never null)
+     */
+    Collection<Property> 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..8d243f773e50 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
@@ -16,10 +16,13 @@
  */
 package org.apache.camel.impl.console;
 
+import java.util.Collection;
 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 +65,23 @@ 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) {
+            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");
+            }
+        }
+
         return sb.toString();
     }
 
@@ -82,6 +102,26 @@ 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) {
+            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);
+                }
+            }
+        }
+
         return root;
     }
 

Reply via email to