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 e90502dc4dfe2..482f95f8cf1f5 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 @@ -23,11 +23,13 @@ import io.quarkus.agroal.runtime.DataSourceSupport; import io.quarkus.agroal.runtime.DataSources; import io.quarkus.agroal.runtime.DataSourcesJdbcBuildTimeConfig; +import io.quarkus.agroal.runtime.JdbcDriver; import io.quarkus.agroal.runtime.TransactionIntegration; import io.quarkus.agroal.spi.JdbcDataSourceBuildItem; import io.quarkus.agroal.spi.JdbcDriverBuildItem; import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; +import io.quarkus.arc.deployment.UnremovableBeanBuildItem; import io.quarkus.arc.processor.DotNames; import io.quarkus.bootstrap.classloading.QuarkusClassLoader; import io.quarkus.datasource.common.runtime.DataSourceUtil; @@ -197,7 +199,10 @@ void generateDataSourceSupportBean(AgroalRecorder recorder, SslNativeConfigBuildItem sslNativeConfig, Capabilities capabilities, BuildProducer additionalBeans, - BuildProducer syntheticBeanBuildItemBuildProducer) { + BuildProducer syntheticBeanBuildItemBuildProducer, + BuildProducer unremovableBeans) { + additionalBeans.produce(new AdditionalBeanBuildItem(JdbcDriver.class)); + if (aggregatedBuildTimeConfigBuildItems.isEmpty()) { // No datasource has been configured so bail out return; @@ -209,8 +214,8 @@ void generateDataSourceSupportBean(AgroalRecorder recorder, // add the @DataSource class otherwise it won't be registered as a qualifier additionalBeans.produce(AdditionalBeanBuildItem.builder().addBeanClass(DataSource.class).build()); - // add implementations of AgroalPoolInterceptor - additionalBeans.produce(AdditionalBeanBuildItem.unremovableOf(AgroalPoolInterceptor.class)); + // make AgroalPoolInterceptor beans unremovable, users still have to make them beans + unremovableBeans.produce(UnremovableBeanBuildItem.beanTypes(AgroalPoolInterceptor.class)); // create the DataSourceSupport bean that DataSourceProducer uses as a dependency DataSourceSupport dataSourceSupport = getDataSourceSupport(aggregatedBuildTimeConfigBuildItems, sslNativeConfig,