[ 
https://issues.apache.org/jira/browse/CAMEL-23550?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thomas Cunningham updated CAMEL-23550:
--------------------------------------
    Description: 
When Kamelet templates define beans in their `beans:` section, those beans are 
registered in the RouteTemplateContext's *{*}local bean repository{*}* for 
proper scoping and isolation. However, when the route references these beans 
(e.g., `schemaResolver: "#bean:{{{}schemaResolver{}}}"`), the AbstractReifier 
only checks the global registry and fails to find them.

The best reproducer is the actual integration test from camel-kamelets:

```bash
cd /Users/tcunning/src/community/camel-kamelets
mvn test -Dtest=ProtobufIT
```

This uses real Kamelets (protobuf-deserialize-action, 
protobuf-serialize-action) that define and reference beans.

The Core Problem

Current Lookup Order (BROKEN)
1. EndpointHelper.resolveReferenceParameter
2. Global registry
3. ❌ Missing: RouteTemplateContext local bean repository

Fixed Lookup Order
1. EndpointHelper.resolveReferenceParameter
2. ✅ RouteTemplateContext local bean repository (NEW)
3. Global registry (fallback)
 

Why This Matters

Many Kamelets in the catalog are affected:
 - ✅ protobuf-deserialize-action (defines schemaResolver bean)
 - ✅ protobuf-serialize-action (defines schemaResolver bean)
 - ✅ avro-deserialize-action (defines schemaResolver bean)
 - ✅ avro-serialize-action (defines schemaResolver bean)
 - ✅ data-type-action (defines dataTypeProcessor bean)
 - Any Kamelet using the `beans:` template section

Without this fix, these Kamelets throw `NoSuchBeanException` when trying to 
reference their own beans.
 

  was:
When Kamelet templates define beans in their `beans:` section, those beans are 
registered in the RouteTemplateContext's **local bean repository** for proper 
scoping and isolation. However, when the route references these beans (e.g., 
`schemaResolver: "#bean:\{{schemaResolver}}"`), the AbstractReifier only checks 
the global registry and fails to find them.

The best reproducer is the actual integration test from camel-kamelets:

```bash
cd /Users/tcunning/src/community/camel-kamelets
mvn test -Dtest=ProtobufIT
```

This uses real Kamelets (protobuf-deserialize-action, 
protobuf-serialize-action) that define and reference beans.

## The Core Problem

### Current Lookup Order (BROKEN)
1. EndpointHelper.resolveReferenceParameter
2. Global registry
3. ❌ Missing: RouteTemplateContext local bean repository

### Fixed Lookup Order
1. EndpointHelper.resolveReferenceParameter
2. ✅ RouteTemplateContext local bean repository (NEW)
3. Global registry (fallback)
 
## Why This Matters

Many Kamelets in the catalog are affected:
- ✅ protobuf-deserialize-action (defines schemaResolver bean)
- ✅ protobuf-serialize-action (defines schemaResolver bean)
- ✅ avro-deserialize-action (defines schemaResolver bean)
- ✅ avro-serialize-action (defines schemaResolver bean)
- ✅ data-type-action (defines dataTypeProcessor bean)
- Any Kamelet using the `beans:` template section

Without this fix, these Kamelets throw `NoSuchBeanException` when trying to 
reference their own beans.
 


> AbstractReifier Local Bean Repository Lookup
> --------------------------------------------
>
>                 Key: CAMEL-23550
>                 URL: https://issues.apache.org/jira/browse/CAMEL-23550
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core, camel-kamelet
>            Reporter: Thomas Cunningham
>            Priority: Major
>
> When Kamelet templates define beans in their `beans:` section, those beans 
> are registered in the RouteTemplateContext's *{*}local bean repository{*}* 
> for proper scoping and isolation. However, when the route references these 
> beans (e.g., `schemaResolver: "#bean:{{{}schemaResolver{}}}"`), the 
> AbstractReifier only checks the global registry and fails to find them.
> The best reproducer is the actual integration test from camel-kamelets:
> ```bash
> cd /Users/tcunning/src/community/camel-kamelets
> mvn test -Dtest=ProtobufIT
> ```
> This uses real Kamelets (protobuf-deserialize-action, 
> protobuf-serialize-action) that define and reference beans.
> The Core Problem
> Current Lookup Order (BROKEN)
> 1. EndpointHelper.resolveReferenceParameter
> 2. Global registry
> 3. ❌ Missing: RouteTemplateContext local bean repository
> Fixed Lookup Order
> 1. EndpointHelper.resolveReferenceParameter
> 2. ✅ RouteTemplateContext local bean repository (NEW)
> 3. Global registry (fallback)
>  
> Why This Matters
> Many Kamelets in the catalog are affected:
>  - ✅ protobuf-deserialize-action (defines schemaResolver bean)
>  - ✅ protobuf-serialize-action (defines schemaResolver bean)
>  - ✅ avro-deserialize-action (defines schemaResolver bean)
>  - ✅ avro-serialize-action (defines schemaResolver bean)
>  - ✅ data-type-action (defines dataTypeProcessor bean)
>  - Any Kamelet using the `beans:` template section
> Without this fix, these Kamelets throw `NoSuchBeanException` when trying to 
> reference their own beans.
>  



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

Reply via email to