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

Move RESTEasy provider registration as unremovable beans to common module #22609

Merged
merged 2 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ ResteasyInjectionReadyBuildItem setupResteasyInjection(
JaxrsProvidersToRegisterBuildItem setupProviders(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
CombinedIndexBuildItem indexBuildItem,
BeanArchiveIndexBuildItem beanArchiveIndexBuildItem,
BuildProducer<UnremovableBeanBuildItem> unremovableBeans,
List<ResteasyJaxrsProviderBuildItem> contributedProviderBuildItems,
List<RestClientBuildItem> restClients,
ResteasyConfigBuildItem resteasyConfig,
Expand Down Expand Up @@ -260,8 +261,14 @@ JaxrsProvidersToRegisterBuildItem setupProviders(BuildProducer<ReflectiveClassBu
"org.jboss.resteasy.plugins.providers.jsonb.AbstractJsonBindingProvider"));
}

return new JaxrsProvidersToRegisterBuildItem(
JaxrsProvidersToRegisterBuildItem result = new JaxrsProvidersToRegisterBuildItem(
providersToRegister, contributedProviders, annotatedProviders, useBuiltinProviders);

// Providers that are also beans are unremovable
unremovableBeans.produce(new UnremovableBeanBuildItem(
b -> result.getProviders().contains(b.getBeanClass().toString())));

return result;
}

private String mutinySupportNeeded(CombinedIndexBuildItem indexBuildItem) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,10 +648,6 @@ private static void registerProviders(ResteasyDeployment deployment,
ServletConfigSource.class,
ServletContextConfigSource.class,
FilterConfigSource.class));

// Providers that are also beans are unremovable
unremovableBeans.produce(new UnremovableBeanBuildItem(
b -> jaxrsProvidersToRegisterBuildItem.getProviders().contains(b.getBeanClass().toString())));
}

private static void generateDefaultConstructors(BuildProducer<BytecodeTransformerBuildItem> transformers,
Expand Down
25 changes: 4 additions & 21 deletions integration-tests/smallrye-opentracing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<!-- Server dependencies -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jackson</artifactId>
<artifactId>quarkus-resteasy-reactive-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand All @@ -43,15 +43,11 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-agroal</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-mutiny</artifactId>
</dependency>

<!-- Client dependencies -->
<dependency>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking about this and I'm not sure it's worth making this test a Frankenstein. I think I would just drop the testing on this one.

But YMMV.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually wanted to have this test because I think it's relatively easy for us to miss this in the future

<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client</artifactId>
<artifactId>quarkus-rest-client-mutiny</artifactId>
</dependency>

<!-- In-memory tracer -->
Expand Down Expand Up @@ -121,20 +117,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jackson-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-mutiny-deployment</artifactId>
<artifactId>quarkus-resteasy-reactive-jackson-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
Expand All @@ -147,7 +130,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client-deployment</artifactId>
<artifactId>quarkus-rest-client-mutiny-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ quarkus.datasource.jdbc.url=jdbc:tracing:postgresql://localhost:5432/mydatabase
quarkus.datasource.jdbc.driver=io.opentracing.contrib.jdbc.TracingDriver
quarkus.datasource.username=sa
quarkus.datasource.password=sa
quarkus.rest.single-default-produces=false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed because RESTEasy Reactive will default to text/plain when returning String from a JAX-RS Resource method, but this default is not what this integration uses


pingpong/mp-rest/url=${test.url}