Skip to content

CAMEL-23652: Fix route template local bean not found when param value matches bean name#23713

Merged
davsclaus merged 1 commit into
mainfrom
CAMEL-23652-route-template-bean-clash
Jun 2, 2026
Merged

CAMEL-23652: Fix route template local bean not found when param value matches bean name#23713
davsclaus merged 1 commit into
mainfrom
CAMEL-23652-route-template-bean-clash

Conversation

@davsclaus
Copy link
Copy Markdown
Contributor

Summary

  • Fix bug where route template local beans (e.g., from kamelets) could not be referenced via {{beanName}} when a template parameter value coincidentally matched the bean name
  • When doStartRouteDefinitions() processes local beans for uniqueness, the first loop detects "clashes" where a parameter value matches a bean key (e.g., scheme=counter where counter is a bean name). It removes the bean from the registry and renames it, but failed to add the original bean name as a template parameter — leaving {{beanName}} references unresolvable
  • Added test testLocalBeanWithParamValueClash covering this scenario

Test plan

  • Existing 72 route template tests pass (now 73 with the new test)
  • External reproducer project from JIRA issue passes
  • New test verifies the exact scenario: local bean referenced via {{counter}} with a parameter scheme=counter that coincidentally matches

Claude Code on behalf of Claus Ibsen

🤖 Generated with Claude Code

… matches bean name

When a template parameter value coincidentally matches a local bean name
(e.g., scheme=counter where counter is also a bean), the bean uniqueness
logic removed the bean from the registry but failed to add the bean name
as a template parameter, making {{beanName}} references unresolvable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added the core label Jun 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

🧪 CI tested the following changed modules:

  • core/camel-core-engine
  • core/camel-core

ℹ️ Dependent modules were not tested because the total number of affected modules exceeded the threshold (50). Use the test-dependents label to force testing all dependents.

⚠️ Some tests are disabled on GitHub Actions (@DisabledIfSystemProperty(named = "ci.env.name")) and require manual verification:

  • core/camel-core: 2 test(s) disabled on GitHub Actions
Build reactor — dependencies compiled but only changed modules were tested (2 modules)
  • Camel :: Core
  • Camel :: Core Engine

⚙️ View full build and test results

assertEquals(1, context.getRoutes().size());

Object out = template.requestBody("direct:one", "World");
assertEquals(0, out);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to ease readability, it would be nice to add a message for assertion explaining why it expects 0

Object out = template.requestBody("direct:one", "World");
assertEquals(0, out);
out = template.requestBody("direct:one", "World");
assertEquals(1, out);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to ease readability, it would be nice to add a message for assertion explaining why it expects 1

@davsclaus davsclaus merged commit c1b135d into main Jun 2, 2026
6 checks passed
@davsclaus davsclaus deleted the CAMEL-23652-route-template-bean-clash branch June 2, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants