From b925a5e4a7a439e3d93c741415023378561a5f00 Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Mon, 13 Jan 2025 15:22:35 +0200 Subject: [PATCH] Register java.sql.Driver service for Agroal Relates to https://github.com/quarkusio/quarkus/issues/41995 --- .../java/io/quarkus/agroal/deployment/AgroalProcessor.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/AgroalProcessor.java b/extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/AgroalProcessor.java index bea70573a34d5c..762150061e6aa1 100644 --- a/extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/AgroalProcessor.java +++ b/extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/AgroalProcessor.java @@ -63,6 +63,7 @@ import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem; import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; +import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem; import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem; import io.quarkus.maven.dependency.ArtifactKey; import io.quarkus.narayana.jta.deployment.NarayanaInitBuildItem; @@ -91,6 +92,7 @@ void build( List jdbcDriverBuildItems, BuildProducer reflectiveClass, BuildProducer resource, + BuildProducer service, Capabilities capabilities, BuildProducer sslNativeSupport, BuildProducer aggregatedConfig, @@ -141,6 +143,9 @@ void build( resource.produce(new NativeImageResourceBuildItem( "META-INF/services/" + io.agroal.api.security.AgroalSecurityProvider.class.getName())); + // accessed through io.quarkus.agroal.runtime.DataSources.loadDriversInTCCL + service.produce(new ServiceProviderBuildItem("java.sql.Driver")); + reflectiveClass.produce(ReflectiveClassBuildItem.builder(io.agroal.pool.ConnectionHandler[].class.getName(), io.agroal.pool.ConnectionHandler.class.getName(), io.agroal.api.security.AgroalDefaultSecurityProvider.class.getName(),