Claus Ibsen created CAMEL-24879:
-----------------------------------

             Summary: camel-main - Bind @BindToRegistry and @Converter classes 
from compiled Groovy sources in exported projects
                 Key: CAMEL-24879
                 URL: https://issues.apache.org/jira/browse/CAMEL-24879
             Project: Camel
          Issue Type: Improvement
          Components: camel-main, camel-jbang, camel-groovy
            Reporter: Claus Ibsen


Follow-up to CAMEL-24873 (PR https://github.com/apache/camel/pull/26678).

{{DefaultGroovyScriptCompiler}} now hands a compiled Groovy class with 
class-level annotations to the registered 
{{org.apache.camel.spi.CompilePostProcessor}}s. Only camel-kamelet-main 
({{AnnotationDependencyInjection}}, wired from {{KameletMain}}) registers such 
post-processors, so this works with {{camel run}} but not in a project created 
with {{camel export}}: camel-main compiles the {{.groovy}} file from 
{{src/main/resources/camel-groovy/}} at startup (via 
{{camel.main.groovyScriptPattern}}), but nothing binds a {{@BindToRegistry}} 
class or registers a {{@Converter}} class, and a custom simple function from 
such a file fails with {{Unknown function}} at runtime. Spring Boot and Quarkus 
register no post-processors either.

The simple-advanced and camel-jbang-beans pages document the limitation and 
point at the inline YAML {{scriptLanguage: groovy}} bean, which works in every 
runtime.

Proposal: have camel-main register a {{CompilePostProcessor}} for 
{{@BindToRegistry}} (and {{@Converter}}) so an exported camel-main project 
behaves like {{camel run}}; then decide whether Spring Boot / Quarkus should do 
the same for their own annotations, or whether {{camel export}} should convert 
an annotated {{.groovy}} file for those runtimes.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to