You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Helidon version 4.1.3 with MicroProfile Config and encountered an unusual exception when injecting org.eclipse.microprofile.config.inject.ConfigProperty with jakarta.inject.Provider<Boolean>. The error message states:
org.jboss.weld.exceptions.UnsatisfiedResolutionException:
WELD-001334: Unsatisfied dependencies for type Boolean with qualifiers @ConfigProperty
at org.jboss.weld.bean.builtin.InstanceImpl.checkBeanResolved(InstanceImpl.java:251)
at org.jboss.weld.bean.builtin.InstanceImpl.get(InstanceImpl.java:113)
at it.test.com.my.WalkthroughIT.whenGetConfigFromProvider(WalkthroughIT.java:88)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:38)
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:106)
at it.test.com.my.WalkthroughIT$Proxy$_$$_WeldClientProxy.whenGetConfigFromProvider(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
Steps to reproduce
Below is my test class:
packageit.test.com.my;
importorg.eclipse.microprofile.config.inject.ConfigProperty;
importio.helidon.microprofile.testing.junit5.HelidonTest;
importjakarta.inject.Inject;
importjakarta.inject.Provider;
@HelidonTestclassWalkthroughIT {
@Inject@ConfigProperty(
name = "providerBoolean", defaultValue = "true"
)
privateProvider<Boolean> providerBoolean;
@Test@DisplayName(
"When getting config from provider, it must succeed."
)
voidwhenGetConfigFromProvider() {
BDDAssertions.then(this.providerBoolean).isNotNull();
BDDAssertions.then(this.providerBoolean.get()).isTrue(); // <--- Exception thrown here.
}
}
NOTE
Surprisingly, when there is an additional injection of org.eclipse.microprofile.config.inject.ConfigProperty directly with Boolean, no exception occurs.
packageit.test.com.my;
importorg.eclipse.microprofile.config.inject.ConfigProperty;
importio.helidon.microprofile.testing.junit5.HelidonTest;
importjakarta.inject.Inject;
importjakarta.inject.Provider;
@HelidonTestclassWalkthroughIT {
@Inject@ConfigProperty(
name = "providerBoolean", defaultValue = "true"
)
privateProvider<Boolean> providerBoolean;
@Inject@ConfigProperty(
name = "objectBoolean", defaultValue = "true"
)
privateBooleanobjectBoolean; // <--- Here is an additional.@Test@DisplayName(
"When getting config from provider, it must succeed."
)
voidwhenGetConfigFromProvider() {
BDDAssertions.then(this.providerBoolean).isNotNull();
BDDAssertions.then(this.providerBoolean.get()).isTrue(); // <--- This works like a charm.
}
}
Could you please provide further advice? Thank you very much for your help in advance. I look forward to hearing from you soon.
The text was updated successfully, but these errors were encountered:
packageit.test.com.my;
importorg.eclipse.microprofile.config.inject.ConfigProperty;
importio.helidon.microprofile.testing.junit5.HelidonTest;
importjakarta.inject.Inject;
importjakarta.inject.Provider;
@HelidonTestclassWalkthroughIT {
@Inject@ConfigProperty(
name = "providerTimeUnit", defaultValue = "MILLISECONDS"
)
privateProvider<TimeUnit> providerTimeUnit;
@Inject@ConfigProperty(
name = "objectTimeUnit", defaultValue = "SECONDS"
)
privateTimeUnitobjectTimeUnit; // <--- Here is an additional.// <--- Without it, an exception is thrown.@Test@DisplayName(
"When getting config from provider, it must succeed."
)
voidwhenGetConfigFromProvider() {
BDDAssertions.then(this.providerTimeUnit).isNotNull();
BDDAssertions.then(this.providerTimeUnit.get()).
isEqualTo(TimeUnit.MILLISECONDS); // <--- This works like a charm.
}
}
Environment Details
Problem Description
I am using
Helidon
version4.1.3
withMicroProfile Config
and encountered an unusual exception when injectingorg.eclipse.microprofile.config.inject.ConfigProperty
withjakarta.inject.Provider<Boolean>
. The error message states:Steps to reproduce
Below is my test class:
NOTE
Surprisingly, when there is an additional injection of
org.eclipse.microprofile.config.inject.ConfigProperty
directly withBoolean
, no exception occurs.Could you please provide further advice? Thank you very much for your help in advance. I look forward to hearing from you soon.
The text was updated successfully, but these errors were encountered: