This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch gs in repository https://gitbox.apache.org/repos/asf/camel.git
commit 0a05ed3c13cec98d7029e9b934787b511ab7b160 Author: Claus Ibsen <[email protected]> AuthorDate: Mon Jul 14 13:17:28 2025 +0200 CAMEL-22214: camel-groovy - Allow to pre-load groovy source files for shared functions and DTOs --- .../apache/camel/main/DefaultConfigurationConfigurer.java | 3 ++- .../apache/camel/main/DefaultConfigurationProperties.java | 14 ++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java index 66381be9c6f..035ea76210d 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java @@ -291,7 +291,8 @@ public final class DefaultConfigurationConfigurer { if (config.getGroovyScriptPattern() != null) { GroovyScriptCompiler gsc = camelContext.getCamelContextExtension().getContextPlugin(GroovyScriptCompiler.class); gsc.setScriptPattern(config.getGroovyScriptPattern()); - camelContext.addService(gsc); + // force start compiler eager so Camel routes can load these pre-compiled classes + camelContext.addService(gsc, true, true); } if (camelContext.getManagementStrategy().getManagementAgent() != null) { diff --git a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java index 986488440f4..f09fca6bb2c 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java @@ -1400,13 +1400,12 @@ public abstract class DefaultConfigurationProperties<T> { } /** - * Directories to scan for groovy source to be pre-compiled. - * For example: scripts/*.groovy will scan inside the classpath folder scripts for all groovy source files. + * Directories to scan for groovy source to be pre-compiled. For example: scripts/*.groovy will scan inside the + * classpath folder scripts for all groovy source files. * * By default, sources are scanned from the classpath, but you can prefix with file: to use file system. * - * The directories are using Ant-path style pattern, and - * multiple directories can be specified separated by comma. + * The directories are using Ant-path style pattern, and multiple directories can be specified separated by comma. */ public void setGroovyScriptPattern(String groovyScriptPattern) { this.groovyScriptPattern = groovyScriptPattern; @@ -2787,13 +2786,12 @@ public abstract class DefaultConfigurationProperties<T> { } /** - * Directories to scan for groovy source to be pre-compiled. - * For example: scripts/*.groovy will scan inside the classpath folder scripts for all groovy source files. + * Directories to scan for groovy source to be pre-compiled. For example: scripts/*.groovy will scan inside the + * classpath folder scripts for all groovy source files. * * By default, sources are scanned from the classpath, but you can prefix with file: to use file system. * - * The directories are using Ant-path style pattern, and - * multiple directories can be specified separated by comma. + * The directories are using Ant-path style pattern, and multiple directories can be specified separated by comma. */ public T withGroovyScriptPattern(String groovyScriptPattern) { this.groovyScriptPattern = groovyScriptPattern;
