You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Antonin Stefanutti (JIRA)" <ji...@apache.org> on 2016/04/04 14:14:25 UTC

[jira] [Resolved] (CAMEL-9798) camel-cdi - Add support for injecting default ProducerTemplate

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

Antonin Stefanutti resolved CAMEL-9798.
---------------------------------------
    Resolution: Fixed

> camel-cdi - Add support for injecting default ProducerTemplate
> --------------------------------------------------------------
>
>                 Key: CAMEL-9798
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9798
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-cdi
>    Affects Versions: 2.17.0
>            Reporter: Claus Ibsen
>            Assignee: Antonin Stefanutti
>             Fix For: 2.17.1, 2.18.0
>
>
> We should be able to inject a default producer template using
> {code}
>     @Inject
>     private ProducerTemplate template;
> {code}
> Currently that does not work and you get an error (see below)
> But if you setup a default endpoint with @Uri it works
> {code}
>     @Inject @Uri("file:target/inbox")
>     private ProducerTemplate template;
> {code}
> The error you get
> {code}
> org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type ProducerTemplate with qualifiers @Default
>   at injection point [BackedAnnotatedField] @Inject private camelinaction.FirstTest.template
>   at camelinaction.FirstTest.template(FirstTest.java:0)
> WELD-001475: The following beans match by type, but none have matching qualifiers:
>   - Producer Method [ProducerTemplate] with qualifiers [@Excluded @Any] declared as [[UnbackedAnnotatedMethod] @Produces @Excluded private static org.apache.camel.cdi.CdiCamelFactory.producerTemplate(InjectionPoint, @Any Instance<CamelContext>, CdiCamelExtension)],
>   - Producer Method [ProducerTemplate] with qualifiers [@Excluded @Any] declared as [[UnbackedAnnotatedMethod] @Produces @Excluded private static org.apache.camel.cdi.CdiCamelFactory.producerTemplate(InjectionPoint, @Any Instance<CamelContext>, CdiCamelExtension)]
> 	at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:359)
> 	at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:281)
> 	at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:134)
> 	at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:155)
> 	at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
> 	at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
> 	at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
> 	at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
> 	at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> 	at java.lang.Thread.run(Thread.java:745)
> {code}
> The same thing for ConsumerTemplate which should also be injectable.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)