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 authored and gsmet committed Oct 21, 2024
1 parent 9c39028 commit 0b43e92
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import javax.sql.XADataSource;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Singleton;

import org.jboss.jandex.ClassType;
import org.jboss.jandex.DotName;
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 0b43e92

Please sign in to comment.