Skip to content

Commit

Permalink
Fix Agroal CDI setup
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmet committed Sep 21, 2022
1 parent 8de3274 commit bd01e6a
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -197,7 +199,10 @@ void generateDataSourceSupportBean(AgroalRecorder recorder,
SslNativeConfigBuildItem sslNativeConfig,
Capabilities capabilities,
BuildProducer<AdditionalBeanBuildItem> additionalBeans,
BuildProducer<SyntheticBeanBuildItem> syntheticBeanBuildItemBuildProducer) {
BuildProducer<SyntheticBeanBuildItem> syntheticBeanBuildItemBuildProducer,
BuildProducer<UnremovableBeanBuildItem> unremovableBeans) {
additionalBeans.produce(new AdditionalBeanBuildItem(JdbcDriver.class));

if (aggregatedBuildTimeConfigBuildItems.isEmpty()) {
// No datasource has been configured so bail out
return;
Expand All @@ -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,
Expand Down

0 comments on commit bd01e6a

Please sign in to comment.