Skip to content

Commit

Permalink
Automatically lookup Providers based on the presence of standard Jaka…
Browse files Browse the repository at this point in the history
…rta file

Closes: #33262
  • Loading branch information
geoand committed May 10, 2023
1 parent efc0f9b commit 0aabc21
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.stream.Collectors;

import jakarta.ws.rs.Priorities;
import jakarta.ws.rs.ext.Providers;
import jakarta.ws.rs.ext.RuntimeDelegate;

import org.jboss.jandex.AnnotationTarget;
Expand Down Expand Up @@ -47,6 +48,7 @@
import io.quarkus.arc.deployment.GeneratedBeanBuildItem;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.AdditionalApplicationArchiveMarkerBuildItem;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
Expand All @@ -70,6 +72,14 @@ public class ResteasyReactiveCommonProcessor {
private static final int LEGACY_READER_PRIORITY = Priorities.USER * 2; // readers are compared by decreased priority
private static final int LEGACY_WRITER_PRIORITY = Priorities.USER / 2; // writers are compared by increased priority

private static final String PROVIDERS_SERVICE_FILE = "META-INF/services/" + Providers.class.getName();

@BuildStep
AdditionalApplicationArchiveMarkerBuildItem searchForProviders() {
// TODO: should we also be looking for the specific provider files?
return new AdditionalApplicationArchiveMarkerBuildItem(PROVIDERS_SERVICE_FILE);
}

@BuildStep
void setUpDenyAllJaxRs(
CombinedIndexBuildItem index,
Expand Down

0 comments on commit 0aabc21

Please sign in to comment.