camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonin Stefanutti <anto...@stefanutti.fr>
Subject Re: Why do we have we to specify a context for @PropertyInject ?
Date Wed, 29 Mar 2017 17:03:28 GMT
Hi Bernard,

Specifying the context attribute for @PropertyInject is currently necessary when dealing with
multiple Camel contexts so that the bean post processing can resolve the Camel context to
use. If it is not specified, then the default (following CDI semantic, that is with the @Default
qualifier) Camel context is resolved.

There is no further logic nor convention beyond that context attribute. I guess this is the
way other DI frameworks handle bean post processing as well to support Camel annotations (which
all have that context attribute).

That being said, we could add more sensible convention to the default behaviour, like when
processing beans of type CamelContextAware, or BuilderSupport in you case, for which a Camel
context may have been set already.

I would suggest you create a ticket in JIRA to track that enhancement.

Antonin

> On 29 Mar 2017, at 15:58, Bernard Ligny <bernard.ligny@gmail.com> wrote:
> 
> I am using Camel-CDI features in a war with multiple camel contexts
> (initialised via a factory), all of them sharing the same set of Camel
> components (initialised via a factory):
> 
> 
> In a route being part of a particular context, I want to inject properties
> (coming from my property file):
> 
> 
> This is working fine...as soon as i specify a context on the
> @PropertyInject.
> I do not understand why the context addition is necessary as:
> - the context is already set on the route builder 
> - my properties component is shared across all contexts (cfr
> @ApplicationScoped) 
> 
> 
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Why-do-we-have-we-to-specify-a-context-for-PropertyInject-tp5796699.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message