Details
Description
We should be able to inject a default producer template using
@Inject
private ProducerTemplate template;
Currently that does not work and you get an error (see below)
But if you setup a default endpoint with @Uri it works
@Inject @Uri("file:target/inbox") private ProducerTemplate template;
The error you get
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)
The same thing for ConsumerTemplate which should also be injectable.