Skip to content

Commit

Permalink
Align the CDI bean AgroalDataSourceSupport on DataSourceSupport
Browse files Browse the repository at this point in the history
Make it a singleton, initialize it on runtime init.
  • Loading branch information
yrodiere committed Oct 21, 2024
1 parent 9c39028 commit 914ffe0
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import jakarta.enterprise.context.ApplicationScoped;

import jakarta.inject.Singleton;
import org.jboss.jandex.ClassType;
import org.jboss.jandex.DotName;
import org.jboss.logging.Logger;
Expand Down Expand Up @@ -233,13 +234,15 @@ void generateDataSourceSupportBean(AgroalRecorder recorder,
// 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
// create the AgroalDataSourceSupport bean that DataSources/DataSourceHealthCheck use as a dependency
AgroalDataSourceSupport agroalDataSourceSupport = getDataSourceSupport(aggregatedBuildTimeConfigBuildItems,
sslNativeConfig,
capabilities);
syntheticBeanBuildItemBuildProducer.produce(SyntheticBeanBuildItem.configure(AgroalDataSourceSupport.class)
.supplier(recorder.dataSourceSupportSupplier(agroalDataSourceSupport))
.scope(Singleton.class)
.unremovable()
.setRuntimeInit()
.done());
}

Expand Down

0 comments on commit 914ffe0

Please sign in to comment.