Skip to content

Commit

Permalink
Register jakarta.json.spi.JsonProvider service provider
Browse files Browse the repository at this point in the history
`META-INF/services/jakarta.json.spi.JsonProvider` is accessed as a
resource by SmallRyeHealthReporter. Registering the service provider
removes warnings related to the access when using
`-H:ThrowMissingRegistrationErrors=`
  • Loading branch information
zakkak committed Nov 26, 2024
1 parent 9361824 commit 4aaf21d
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;

public class JsonpProcessor {

@BuildStep
void build(BuildProducer<FeatureBuildItem> feature,
BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
BuildProducer<NativeImageResourceBundleBuildItem> resourceBundle) {
BuildProducer<ServiceProviderBuildItem> serviceProviders) {
reflectiveClass.produce(
ReflectiveClassBuildItem.builder(JsonProviderImpl.class.getName()).build());

// Register jakarta.json.spi.JsonProvider provider which is accessed by SmallRyeHealthReporter
serviceProviders.produce(new ServiceProviderBuildItem("jakarta.json.spi.JsonProvider"));
}

}

0 comments on commit 4aaf21d

Please sign in to comment.