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 d1afebe772fe CAMEL-23547: camel-core - Properties component should
eager start custom functions resolver. Same for jbang that has a custom
resolver.
d1afebe772fe is described below
commit d1afebe772fea171e0bb99ac4d6fd462ed12dcfb
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon May 18 17:17:07 2026 +0200
CAMEL-23547: camel-core - Properties component should eager start custom
functions resolver. Same for jbang that has a custom resolver.
---
.../properties/DefaultPropertiesFunctionResolver.java | 9 ++++++++-
.../src/main/java/org/apache/camel/main/KameletMain.java | 13 ++++++++++---
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git
a/core/camel-base/src/main/java/org/apache/camel/component/properties/DefaultPropertiesFunctionResolver.java
b/core/camel-base/src/main/java/org/apache/camel/component/properties/DefaultPropertiesFunctionResolver.java
index f5951dafffc5..280ad64f12c8 100644
---
a/core/camel-base/src/main/java/org/apache/camel/component/properties/DefaultPropertiesFunctionResolver.java
+++
b/core/camel-base/src/main/java/org/apache/camel/component/properties/DefaultPropertiesFunctionResolver.java
@@ -116,7 +116,9 @@ public class DefaultPropertiesFunctionResolver extends
ServiceSupport
}
@Override
- protected void doInit() throws Exception {
+ protected void doBuild() throws Exception {
+ super.doBuild();
+
// include out of the box functions
addPropertiesFunction(new EnvPropertiesFunction());
addPropertiesFunction(new SysPropertiesFunction());
@@ -125,6 +127,11 @@ public class DefaultPropertiesFunctionResolver extends
ServiceSupport
addPropertiesFunction(new ServicePortPropertiesFunction());
addPropertiesFunction(new BooleanPropertiesFunction());
+ ServiceHelper.buildService(functions.values());
+ }
+
+ @Override
+ protected void doInit() throws Exception {
functions.values().forEach(f ->
CamelContextAware.trySetCamelContext(f, camelContext));
ServiceHelper.initService(functions.values());
}
diff --git
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
index 0b9be895dc08..f9f797ba91ad 100644
---
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
+++
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
@@ -453,7 +453,11 @@ public class KameletMain extends MainCommandLineSupport {
setupExport(answer, true);
} else {
PropertiesComponent pc = (PropertiesComponent)
answer.getPropertiesComponent();
- pc.setPropertiesFunctionResolver(new
DependencyDownloaderPropertiesFunctionResolver(answer, false, transform));
+ // create resolver that can download dependencies for known
functions
+ var resolver = new
DependencyDownloaderPropertiesFunctionResolver(answer, false, transform);
+ resolver.setCamelContext(answer);
+ resolver.start();
+ pc.setPropertiesFunctionResolver(resolver);
}
// groovy scripts
@@ -795,8 +799,11 @@ public class KameletMain extends MainCommandLineSupport {
addInitialProperty("camel.component.properties.ignore-missing-location",
"true");
PropertiesComponent pc = (PropertiesComponent)
answer.getPropertiesComponent();
pc.setPropertiesParser(new ExportPropertiesParser(answer));
- pc.setPropertiesFunctionResolver(new
DependencyDownloaderPropertiesFunctionResolver(answer, export, false));
-
+ // create resolver that can download dependencies for known functions
+ var resolver = new
DependencyDownloaderPropertiesFunctionResolver(answer, export, false);
+ resolver.setCamelContext(answer);
+ resolver.start();
+ pc.setPropertiesFunctionResolver(resolver);
// override default type converters with our export converter that is
more flexible during exporting
ExportTypeConverter ec = new ExportTypeConverter();
answer.getTypeConverterRegistry().setTypeConverterExists(TypeConverterExists.Override);