bambambam opened a new pull request, #31420: URL: https://github.com/apache/camel/pull/31420
# Description Fixes [CAMEL-28093](https://issues.apache.org/jira/browse/CAMEL-28093). When exporting a route whose `transacted` step specifies a standard `PROPAGATION_*` policy ref (e.g. `ref: PROPAGATION_REQUIRED`), `TransactedDownloader.bindPassThroughPolicies` skips binding placeholder policies because `transacted.getRef() != null`, causing `AbstractPolicyReifier.resolvePolicy` to fail with `NoSuchBeanException: No bean could be found in the registry for: PROPAGATION_REQUIRED of type: org.apache.camel.spi.Policy` during `camel export`. This change: - Marks exporting `CamelContext` instances in `KameletMain.setupExport` via the `TransactedDownloader.EXPORT_MODE` global option so the static JVM-wide `TransactedDefinition` reifier inspects the route's own `CamelContext` rather than leaking export mode into subsequent `camel run` invocations in the same JVM. - Adds `TransactedDownloader.bindExportPropagationPolicy`, which while exporting binds a `PassThroughTransactedPolicy` under `transacted.getRef()` only when it is one of the seven standard `PROPAGATION_*` names and no bean with that name is already in the registry. - Leaves `camel run` and non-standard custom policy refs unchanged (both still fail on missing beans). ### Testing - Added unit and `KameletMain` isolation tests in [`TransactedDownloaderTest`](dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/download/TransactedDownloaderTest.java) verifying standard `PROPAGATION_*` export binding, user-bean preservation, ignoring non-standard refs, and verifying a subsequent non-export `KameletMain` in the same JVM still fails on a missing `PROPAGATION_REQUIRED` bean. - Added [`ExportTest.shouldExportTransactedWithPropagationRef`](dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ExportTest.java) across Quarkus, Spring Boot, and Camel Main, plus `shouldFailExportWhenTransactedUsesUnknownCustomPolicyRef`. - Verified `mvn formatter:format impsort:sort`, `mvn install -Psourcecheck -pl dsl/camel-kamelet-main`, and `mvn test -Psourcecheck -pl dsl/camel-jbang/camel-jbang-core -Dtest=ExportTest` (55/55 passed). # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [x] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. # AI-assisted contributions - [x] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR description identifies the AI tool used. _Antigravity on behalf of bambambam_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
