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 f53880207a3fdc70a432c1f15b58ecf7fe2c4d17 Author: Claus Ibsen <[email protected]> AuthorDate: Mon Jul 14 13:56:34 2025 +0200 CAMEL-22214: camel-groovy - Allow to pre-load groovy source files for shared functions and DTOs --- .../apache/camel/main/DefaultConfigurationConfigurer.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 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 035ea76210d..01c95520170 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 @@ -97,6 +97,7 @@ import org.apache.camel.support.RouteWatcherReloadStrategy; import org.apache.camel.support.ShortUuidGenerator; import org.apache.camel.support.SimpleUuidGenerator; import org.apache.camel.support.jsse.GlobalSSLContextParametersSupplier; +import org.apache.camel.support.service.ServiceHelper; import org.apache.camel.support.startup.BacklogStartupStepRecorder; import org.apache.camel.support.startup.LoggingStartupStepRecorder; import org.apache.camel.util.ObjectHelper; @@ -288,12 +289,6 @@ public final class DefaultConfigurationConfigurer { ContextReloadStrategy reloader = new DefaultContextReloadStrategy(); camelContext.addService(reloader); } - if (config.getGroovyScriptPattern() != null) { - GroovyScriptCompiler gsc = camelContext.getCamelContextExtension().getContextPlugin(GroovyScriptCompiler.class); - gsc.setScriptPattern(config.getGroovyScriptPattern()); - // force start compiler eager so Camel routes can load these pre-compiled classes - camelContext.addService(gsc, true, true); - } if (camelContext.getManagementStrategy().getManagementAgent() != null) { camelContext.getManagementStrategy().getManagementAgent() @@ -357,6 +352,13 @@ public final class DefaultConfigurationConfigurer { } cs.setWorkDir(config.getCompileWorkDir()); } + 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 + ServiceHelper.startService(gsc); + } if (config.getRouteFilterIncludePattern() != null || config.getRouteFilterExcludePattern() != null) { camelContext.getCamelContextExtension().getContextPlugin(Model.class).setRouteFilterPattern(
