quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.74k stars 2.67k forks source link

Resteasy Reactive client tries to use ContainerResponseFilter #31024

Closed Postremus closed 11 months ago

Postremus commented 1 year ago

Describe the bug

I am using rest-client-reactive, but not a server impl like resteasy-reactive.

A common library which provides a ContainerResponseFilter. This filter is apparently registered when I build a RestClient using the programmatic api.

RestClientBuilder builder = RestClientBuilder.newBuilder()//
                .baseUri(URI.create("https://restcountries.com"));

        RestCountryAPI api = builder.build(RestCountryAPI.class);

I debugged this a bit, and found that the annotationRegisteredProviders also contain the ContainerResponseFilters, though these should imo be excluded for the rest client.

In RestClientBuilderImpl: image

Expected behavior

ContainerResponseFilters should not be applied to rest clients.

Actual behavior

__  ____  __  _____   ___  __ ____  ______
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2023-02-09 07:25:00,518 WARN  [io.qua.arc.impl] (Quarkus Main Thread) 
================================================================================
CDI: programmatic lookup problem detected
-----------------------------------------
At least one bean matched the required type and qualifiers but was marked as unused and removed during build

Stack frame: io.quarkus.rest.client.reactive.runtime.RestClientBuilderImpl.register(RestClientBuilderImpl.java:188)
Required type: class org.acme.VersionHeaderFilter
Required qualifiers: [@javax.enterprise.inject.Default()]
Removed beans:
        - CLASS bean  [types=[class org.acme.VersionHeaderFilter, interface javax.ws.rs.container.ContainerResponseFilter], qualifiers=null]
Solutions:
        - Application developers can eliminate false positives via the @Unremovable annotation
        - Extensions can eliminate false positives via build items, e.g. using the UnremovableBeanBuildItem
        - See also https://quarkus.io/guides/cdi-reference#remove_unused_beans
        - Enable the DEBUG log level to see the full stack trace
================================================================================

How to Reproduce?

Reproducer:
rcr-remove-filter.zip

  1. mvn clean compile quarkus:dev
  2. Warning from above happens

Output of uname -a or ver

MINGW64_NT-10.0-19044 NANBCHL9NG3 3.3.6-341.x86_64 2022-09-05 20:28 UTC x86_64 Msys

Output of java -version

openjdk 17.0.4 2022-07-19 OpenJDK Runtime Environment Temurin-17.0.4+8 (build 17.0.4+8) OpenJDK 64-Bit Server VM Temurin-17.0.4+8 (build 17.0.4+8, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.16.2.Final

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

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537) Maven home: C:\eclipse\tools\java\maven Java version: 17.0.4, vendor: Eclipse Adoptium, runtime: C:\eclipse\tools\java\17 Default locale: de_DE, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Additional information

No response

quarkus-bot[bot] commented 1 year ago

/cc @FroMage (resteasy-reactive), @Sgitario (resteasy-reactive), @geoand (resteasy-reactive), @stuartwdouglas (resteasy-reactive)

geoand commented 1 year ago

Thanks, I'll have a look

famod commented 11 months ago

31026 did not fix it, unfortunately.

Reopening with a new PR.