2

I have created Quarkus project and added a SpringBoot project dependency in build.gradle file, dependency downloaded successfully. Now when I am trying to inject a class which is available in dependancy, the build is getting failed.

Note: The Class which I am trying to inject does not have @ApplicationScope annotation.

getting below error: Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.test.model.TestService and qualifiers [@Default]

Abdullah Imran
  • 259
  • 3
  • 13
  • Does the dependency have a `beans.xml` file, or a Jandex index? See https://stackoverflow.com/questions/55513502/how-to-create-a-jandex-index-in-quarkus-for-classes-in-a-external-module for more. – Ladicek Oct 18 '21 at 07:10
  • Are you using spring in your project?, is TestService a bean ?, provide a https://stackoverflow.com/help/minimal-reproducible-example otherwise its quite difficult to know the cause of your issue, which may come from different sources. But basically means that your service is not a managed bean or you have more than one a CDI does not know how to select the correct – Javier Toja Oct 18 '21 at 07:12

1 Answers1

0

Look here: https://quarkus.io/guides/cdi-reference

See the section 1 in the document above about creating the bean archive. What worked for me is adding references to the dependencies in my application.properties.

quarkus.index-dependency.[name].group-id=[group]
quarkus.index-dependency.[name].artifact-id=[artifact]

For instance, in my project I injected some OpenTracing beans, ended up with:

quarkus.index-dependency.opentracing.group-id=io.opentracing
quarkus.index-dependency.opentracing.artifact-id=opentracing-api
Patrice Gagnon
  • 1,276
  • 14
  • 14