> On 06 May 2016, at 10:21, kalber <karlheinz.al...@swslt.com> wrote:
> 
> -- In your example below, what exactly does not work with the produceConfig
> producer method?
> Simply 'System.out.println("Not Properties")'  not executed.

CDI beans are lazy-produced, that is the producer methods are only executed if 
instances of those beans are requested.

This works for the PropertiesComponent because the Camel context requests an 
instance of that bean at start time.

So in your example, where is the @Named("not-prop1") bean actually used? If it 
is reference in a Camel route, then it’ll be called when the route starts.

> -- Is it normal that the method return null? 
> It's only a test, wanna see if ' 'System.out.println("Not Properties")'
> works.
> 
> So there is a limitation, only referenced object can be produced.

That is the way CDI works. Beans are lazy instantiated, hence @Produces methods 
are called only if the beans need to be instantiated.

> Wy this limitation, e need to produce auxiliary beans for processing.
> 
> How can i make My Bean reference ?

There are ways to have beans eagerly instantiated, though that’s more a CDI 
question than a Camel question.

Maybe you could share your Camel CDI example so that we can help further.

Antonin

> -----
> kh
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-2-17-Producer-works-only-for-select-objects-tp5782226p5782265.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to