quarkus: 2.14.0.CR1 Class with @Provider and @RequestScoped annotations causes build failure

When changing from 2.13.3.Final to 2.14.0.CR1 Quarkus build fails on our project:

Failed to execute goal io.quarkus:quarkus-maven-plugin:2.14.0.CR1:build (default) on project eclipse-deployable: Failed to build quarkus application: 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: Found 304 deployment problems: 
[1] Unsatisfied dependency for type com.ukheshe.arch.rest.RequestContext and qualifiers [@Default]
	- java member: com.ukheshe.services.reporting.aaa.BaseReportingGateKeeper#context
	- declared on CLASS bean [types=[com.ukheshe.arch.aaa.GateKeeper, com.ukheshe.arch.impl.aaa.SourceIpCheckingGateKeeper, com.ukheshe.arch.impl.aaa.RoleBasedGateKeeper, com.ukheshe.services.reporting.aaa.MoneyMessageReportingGateKeeper, com.ukheshe.services.reporting.aaa.BaseReportingGateKeeper, java.lang.Object], qualifiers=[@Default, @Any], target=com.ukheshe.services.reporting.aaa.MoneyMessageReportingGateKeeper]

The full list of errors is huge but all relate to injecting com.ukheshe.arch.rest.RequestContext The implementation of this class is slightly unique in that it looks like this:

@Provider
@PreMatching
@RequestScoped
@Priority(Priorities.HEADER_DECORATOR + 200)
public class RequestContextImpl implements ContainerRequestFilter, RequestContext {

private ContainerRequestContext containerRequestContext;

@Override
    public void filter(ContainerRequestContext requestContext) throws IOException {
        this.containerRequestContext = requestContext;
    }

If I remove the @Provider annotation then the build succeeds but the application has issues because this class needs to be a ContainerRequestFilter to get the requestContext and use it when this RequestScoped bean is injected.

Not sure if 2.14 has changed something and wont properly process beans that have both @Provider and @RequestScoped

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 25 (18 by maintainers)

Commits related to this issue

Most upvoted comments

https://github.com/quarkusio/quarkus/pull/28946 will allow you to inject ContainerRequestContext directly

I’d like to hear from @bcluap on the reasoning behind using this particular pattern