Remove reflection-based registry lookup in favor of Camel's public API#5
Closed
Copilot wants to merge 3 commits intocodex/add-a2a-supportfrom
Closed
Remove reflection-based registry lookup in favor of Camel's public API#5Copilot wants to merge 3 commits intocodex/add-a2a-supportfrom
Copilot wants to merge 3 commits intocodex/add-a2a-supportfrom
Conversation
…lookup() API Co-authored-by: rdobrik <8812511+rdobrik@users.noreply.github.com>
Co-authored-by: rdobrik <8812511+rdobrik@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [WIP] Address feedback on A2A runtime integration pull request
Remove reflection-based registry lookup in favor of Camel's public API
Mar 17, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Removes brittle reflection-based access to Camel Main’s internal registry in the sample admin MCP bindings by switching to Camel’s public Main.lookup(...) API, and also removes custom Maven launcher scripts.
Changes:
- Replace reflection-based registry lookups with
Main.lookup(name, Object.class)inSampleAdminMcpBindings. - Delete root
mvnw/mvnw.cmdhelper scripts. - Update
.gitignoreto ignore compiled.classfiles and Maven wrapper-related paths.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
samples/agent-support-service/src/main/java/io/dscope/camel/agent/samples/SampleAdminMcpBindings.java |
Switches registry lookups from reflection to Camel’s public Main.lookup(...) and simplifies related helper methods. |
mvnw.cmd |
Removes root Windows Maven launcher script. |
mvnw |
Removes root Unix Maven launcher script. |
.gitignore |
Adds ignore rules for .class files and Maven wrapper-related paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
rdobrik
approved these changes
Mar 18, 2026
rdobrik
approved these changes
Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SampleAdminMcpBindingswas using reflection to access theprotected registryfield onorg.apache.camel.main.Main, which is brittle across Camel versions and can trigger illegal-access warnings/errors. Camel'sMainalready exposes a publiclookup(String, Class)method backed by the same registry.Changes
lookupFromRegistry(Main, String)andimport java.lang.reflect.Fieldmain.lookup(name, Object.class)bindIfMissing,lookup, andrequired— the redundant dual-lookup (registry +main.lookup) collapses to a single callBefore:
After:
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.