This is an automated email from the ASF dual-hosted git repository.
fmariani pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
The following commit(s) were added to refs/heads/main by this push:
new 28a9264ba87 Align PropertiesComponent defaults value to Camel's ones
28a9264ba87 is described below
commit 28a9264ba87a005038dc9b74dcb075eefd19c0b0
Author: Croway <[email protected]>
AuthorDate: Thu Aug 21 14:26:53 2025 +0200
Align PropertiesComponent defaults value to Camel's ones
---
.../camel-spring-boot/src/main/docs/spring-boot.json | 8 +++-----
.../boot/PropertiesComponentConfiguration.java | 7 ++++---
.../boot/CamelAutoConfigurationPropertiesTest.java | 20 ++++++++++++++++++++
.../src/test/resources/application.properties | 1 +
4 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/core/camel-spring-boot/src/main/docs/spring-boot.json
b/core/camel-spring-boot/src/main/docs/spring-boot.json
index 931435c0b7f..c23826ef5ad 100644
--- a/core/camel-spring-boot/src/main/docs/spring-boot.json
+++ b/core/camel-spring-boot/src/main/docs/spring-boot.json
@@ -390,8 +390,7 @@
"name": "camel.component.properties.environment-variable-mode",
"type": "java.lang.Integer",
"description": "Sets the OS environment variables mode (0 = never, 1 =
fallback, 2 = override). The default mode (override) is to use OS environment
variables if present, and override any existing properties. OS environment
variable mode is checked before JVM system property mode",
- "sourceType":
"org.apache.camel.spring.boot.PropertiesComponentConfiguration",
- "defaultValue": 2
+ "sourceType":
"org.apache.camel.spring.boot.PropertiesComponentConfiguration"
},
{
"name": "camel.component.properties.ignore-missing-location",
@@ -417,7 +416,7 @@
"type": "java.lang.Boolean",
"description": "Whether to support nested property placeholders. A
nested placeholder, means that a placeholder, has also a placeholder, that
should be resolved (recursively).",
"sourceType":
"org.apache.camel.spring.boot.PropertiesComponentConfiguration",
- "defaultValue": false
+ "defaultValue": true
},
{
"name": "camel.component.properties.override-properties",
@@ -435,8 +434,7 @@
"name": "camel.component.properties.system-properties-mode",
"type": "java.lang.Integer",
"description": "Sets the JVM system property mode (0 = never, 1 =
fallback, 2 = override). The default mode (override) is to use system
properties if present, and override any existing properties. OS environment
variable mode is checked before JVM system property mode",
- "sourceType":
"org.apache.camel.spring.boot.PropertiesComponentConfiguration",
- "defaultValue": 2
+ "sourceType":
"org.apache.camel.spring.boot.PropertiesComponentConfiguration"
},
{
"name": "camel.dataformat.customizer.enabled",
diff --git
a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/PropertiesComponentConfiguration.java
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/PropertiesComponentConfiguration.java
index d65791d8e87..452934830a0 100644
---
a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/PropertiesComponentConfiguration.java
+++
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/PropertiesComponentConfiguration.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.spring.boot;
+import org.apache.camel.component.properties.PropertiesComponent;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
@@ -51,7 +52,7 @@ public class PropertiesComponentConfiguration {
* Whether to support nested property placeholders. A nested placeholder,
means that a placeholder, has also a
* placeholder, that should be resolved (recursively).
*/
- private Boolean nestedPlaceholder = false;
+ private Boolean nestedPlaceholder = true;
/**
* Sets initial properties which will be used before any locations are
resolved. The option is a
* java.util.Properties type.
@@ -67,13 +68,13 @@ public class PropertiesComponentConfiguration {
* system properties if present, and override any existing properties. OS
environment variable mode is checked
* before JVM system property mode
*/
- private Integer systemPropertiesMode = 2;
+ private Integer systemPropertiesMode =
PropertiesComponent.SYSTEM_PROPERTIES_MODE_OVERRIDE;
/**
* Sets the OS environment variables mode (0 = never, 1 = fallback, 2 =
override). The default mode (override) is to
* use OS environment variables if present, and override any existing
properties. OS environment variable mode is
* checked before JVM system property mode
*/
- private Integer environmentVariableMode = 2;
+ private Integer environmentVariableMode =
PropertiesComponent.ENVIRONMENT_VARIABLES_MODE_OVERRIDE;
/**
* Whether to automatically discovery instances of PropertiesSource from
registry and service factory.
*/
diff --git
a/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationPropertiesTest.java
b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationPropertiesTest.java
index 247c58b8bd6..879c6d4ca83 100644
---
a/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationPropertiesTest.java
+++
b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationPropertiesTest.java
@@ -42,6 +42,9 @@ public class CamelAutoConfigurationPropertiesTest {
@Value("${from}")
String from;
+ @Value("${from}-nested")
+ String fromNested;
+
// Collaborators fixtures
@Autowired
@@ -64,6 +67,8 @@ public class CamelAutoConfigurationPropertiesTest {
@Override
public void configure() throws Exception {
from(from).to("{{to}}");
+
+ from("direct:test-nested").to("{{nested.to}}");
}
};
}
@@ -76,6 +81,7 @@ public class CamelAutoConfigurationPropertiesTest {
// Given
MockEndpoint mockEndpoint = camelContext.getEndpoint("mock:test",
MockEndpoint.class);
mockEndpoint.expectedMessageCount(1);
+ mockEndpoint.reset();
// When
producerTemplate.sendBody(from, "msg");
@@ -84,4 +90,18 @@ public class CamelAutoConfigurationPropertiesTest {
mockEndpoint.assertIsSatisfied();
}
+ @Test
+ public void shouldResolveNestedCamelPlaceholder() throws
InterruptedException {
+ // Given
+ MockEndpoint mockEndpoint = camelContext.getEndpoint("mock:test",
MockEndpoint.class);
+ mockEndpoint.expectedMessageCount(1);
+ mockEndpoint.reset();
+
+ // When
+ producerTemplate.sendBody(fromNested, "msg");
+
+ // Then
+ mockEndpoint.assertIsSatisfied();
+ }
+
}
diff --git a/core/camel-spring-boot/src/test/resources/application.properties
b/core/camel-spring-boot/src/test/resources/application.properties
index 4271cf9693d..58ebd63c74a 100644
--- a/core/camel-spring-boot/src/test/resources/application.properties
+++ b/core/camel-spring-boot/src/test/resources/application.properties
@@ -19,5 +19,6 @@ spring.main.banner-mode=off
from=direct:test
to=mock:test
+nested.to={{to}}
#logging.level.org.apache.camel=DEBUG
\ No newline at end of file