Exception when injecting BatchClient
michaelpombo opened this issue · 5 comments
It's not possible to inject BatchClient
as stated in documentation. When trying to use:
@Inject
BatchClient
got the following error:
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.jberet.rest.client.BatchClient and qualifiers [@Default]
- java member: com.vibertronic.GreetingResource#batchClient
- declared on CLASS bean [types=[java.lang.Object, com.vibertronic.GreetingResource], qualifiers=[@Default, @Any], target=com.vibertronic.GreetingResource]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:484)
at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:378)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:247)
... 12 more
at io.quarkus.builder.Execution.run(Execution.java:116)
at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:153)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:306)
... 9 more
Caused by: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.jberet.rest.client.BatchClient and qualifiers [@Default]
- java member: com.vibertronic.GreetingResource#batchClient
- declared on CLASS bean [types=[java.lang.Object, com.vibertronic.GreetingResource], qualifiers=[@Default, @Any], target=com.vibertronic.GreetingResource]
at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1078)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:255)
at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:129)
at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:428)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Looking at source code base, JBeretRestProcessor
does not add any additional bean as JBeretProcessor.additionalBeans()
does. Maybe there is a missing method in JBeretRestProcessor
?:
@BuildStep
public void additionalBeans(
BuildProducer<AdditionalBeanBuildItem> additionalBeans) {
additionalBeans.produce(new AdditionalBeanBuildItem(JBeretRestProducer.class));
}
Rewrote io.quarkiverse.jberet.rest.deployment.JBeretRestProcessor
adding the following method:
@BuildStep
public void additionalBeans(
BuildProducer<AdditionalBeanBuildItem> additionalBeans) {
additionalBeans.produce(new AdditionalBeanBuildItem(JBeretRestProducer.class));
}
and ran some testes. Now injecting BatchClient
works as documenteded. Is this a viable fix ?
Let me have a look.
Hi @michaelpombo Thanks for noticing this. We had a test, but because we were overriding the producer it looked like it was working properly. I've fixed the issue and added an integration test.
I'm planning a release either today or tomorrow.
Great ! Working as expected now, thanks.
Great! Pushing a release today.