Issues with @Inject in test classes while using @IfBuildProperty #31365
Replies: 1 comment 1 reply
-
Any chance you can provide us with a reproducer so we can look? Thank you! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi All,
I am trying to create a jar with some utility classes which can be used in multiple services. I don't want to create all the beans and want to give individual apps flexibility to enable the bean creation using properties. So I went ahead to create the beans using
@Produces
and@IfBuildProperty
. The bean injection is working fine but during the build, the test classes are failing due toSuppressed: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.test.utils.CommonUtils and qualifiers [@Default]
I have tried the below approaches. None of them worked so far
@ApplicationScoped
+@IfBuildProperty
. Properties are added to the application.properties under the test folder resources@UnlessBuildProfile("test")
along with@IfBuildProperty
and another with@IfBuildProfile("test")
without@IfBuildProperty
@IfBuildProperty
Can someone suggest how to resolve this issue and what is the best way to create conditional beans if my current approach is not feasible?
Beta Was this translation helpful? Give feedback.
All reactions