Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discard providers without annotation when there are only excluded classes #20441

Closed
essobedo opened this issue Sep 29, 2021 · 1 comment · Fixed by #20442
Closed

Discard providers without annotation when there are only excluded classes #20441

essobedo opened this issue Sep 29, 2021 · 1 comment · Fixed by #20442
Labels
area/rest kind/bug Something isn't working
Milestone

Comments

@essobedo
Copy link
Contributor

Describe the bug

In the resteasy-reactive extension, if we exclude providers using build time conditions, it doesn't check anymore if the class has been annotated with @Provider so Arc tries instantiate them all, even those that should be instantiated by a DynamicFeature which leads to errors of type javax.enterprise.inject.UnsatisfiedResolutionException.

Expected behavior

When providers are excluded thanks to build time conditions, Arc should only instantiate providers annotated with @Provider

Actual behavior

When providers are excluded thanks to build time conditions, Arc instantiates all, even those that should be instantiated by a DynamicFeature

How to Reproduce?

Steps to reproduce

  1. Add a provider annotated with a build time condition to enable the class filtering by excluded classes
  2. Add a DynamicFeature that instantiate a filter with parameters that Arc cannot find by itself

Result:

You get an error of type:

java.lang.RuntimeException: 
java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type java.lang.String and qualifiers [@Default]
	- java member: io.quarkus.resteasy.reactive.server.test.simple.BuildProfileTest$ResponseFilter7#<init>()
	- declared on CLASS bean [types=[io.quarkus.resteasy.reactive.server.test.simple.BuildProfileTest$ResponseFilter7, java.lang.Object, javax.ws.rs.container.ContainerResponseFilter], qualifiers=[@Default, @Any], target=io.quarkus.resteasy.reactive.server.test.simple.BuildProfileTest$ResponseFilter7]
	The following beans match by type, but none have matching qualifiers:
		- Bean [class=java.lang.String, qualifiers=[@ConfigProperty, @Any]]
	at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1149)
	at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:266)
	at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:129)
	at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:418)
	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:820)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
	at java.base/java.lang.Thread.run(Thread.java:834)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type java.lang.String and qualifiers [@Default]
	- java member: io.quarkus.resteasy.reactive.server.test.simple.BuildProfileTest$ResponseFilter7#<init>()
	- declared on CLASS bean [types=[io.quarkus.resteasy.reactive.server.test.simple.BuildProfileTest$ResponseFilter7, java.lang.Object, javax.ws.rs.container.ContainerResponseFilter], qualifiers=[@Default, @Any], target=io.quarkus.resteasy.reactive.server.test.simple.BuildProfileTest$ResponseFilter7]
	The following beans match by type, but none have matching qualifiers:
		- Bean [class=java.lang.String, qualifiers=[@ConfigProperty, @Any]]
	at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:567)
	at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:470)
	at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:254)
	... 13 more

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

@quarkus-bot
Copy link

quarkus-bot bot commented Sep 29, 2021

/cc @FroMage, @stuartwdouglas

@quarkus-bot quarkus-bot bot added this to the 2.4 - main milestone Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants