Claus Ibsen created CAMEL-23644:
-----------------------------------

             Summary: camel-cli-connector-starter - Make opt-in and consider 
optional runtime scope
                 Key: CAMEL-23644
                 URL: https://issues.apache.org/jira/browse/CAMEL-23644
             Project: Camel
          Issue Type: Improvement
          Components: camel-spring-boot
            Reporter: Claus Ibsen


Currently the camel-cli-connector-starter has matchIfMissing = true in its 
@ConditionalOnProperty annotation, meaning the CLI connector is enabled by 
default for all Spring Boot Camel applications, including production 
deployments.

The CLI connector is a development-time tool that enables the Camel JBang CLI 
(camel top, camel trace, camel tui, camel ai etc.) to discover and interact 
with running Camel applications. It should not be active in production by 
default.

h3. Problem

There is no reliable way to auto-detect dev vs production mode in Spring Boot:
- Fat JARs use LaunchedURLClassLoader (detectable)
- Layered JARs extracted in Docker use regular classloaders (indistinguishable 
from dev mode)
- Thin JARs use regular classloaders (indistinguishable from dev mode)
- Spring Boot DevTools has the same limitation
- Spring profiles are common (dev/prod) but there is no standard profile name

h3. Proposed changes

1. *Change default to opt-in:* Change @ConditionalOnProperty(name = 
"camel.cli.enabled", matchIfMissing = true) to matchIfMissing = false in 
CliConnectorAutoConfiguration.java

2. *Consider optional runtime scope:* Some users may feel the 
cli-connector-starter dependency is invasive if included transitively. Consider 
making it optional and runtime scoped so it does not leak into downstream 
projects.

3. *Document recommended setup:* Users opt-in via camel.cli.enabled=true in 
their dev profile (application-dev.properties) or via command line 
-Dcamel.cli.enabled=true

h3. Recommended user setup

{code}
# application-dev.properties
camel.cli.enabled=true
{code}

or:

{code}
mvn spring-boot:run -Dcamel.cli.enabled=true
{code}

This ensures zero overhead in production regardless of JAR packaging type, 
while making it trivially easy for developers to enable during development.



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

Reply via email to