Class DataSources

java.lang.Object
io.quarkus.agroal.runtime.DataSources

@Deprecated(since="3.16", forRemoval=true) @Singleton public class DataSources extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
This class should not be used from applications or other extensions. For applications, use CDI to retrieve datasources instead. For extensions, use AgroalDataSourceUtil instead.
This class is sort of a producer for AgroalDataSource.

It isn't a CDI producer in the literal sense, but it created a synthetic bean from AgroalProcessor The createDataSource method is called at runtime (see

invalid reference
AgroalRecorder#agroalDataSourceSupplier(String, DataSourcesRuntimeConfig)
) in order to produce the actual AgroalDataSource objects.
  • Constructor Details

  • Method Details

    • fromName

      @Deprecated public static io.agroal.api.AgroalDataSource fromName(String dataSourceName)
      Deprecated.
      Use AgroalDataSourceUtil.dataSourceInstance(String) instead. This method should not be used as it can very easily lead to timing issues during bean creation.
      Meant to be used from recorders that create synthetic beans that need access to Datasource. In such using Arc.container.instance(DataSource.class) is not possible because Datasource is itself a synthetic bean.

      This method relies on the fact that DataSources should - given the same input - always return the same AgroalDataSource no matter how many times it is invoked (which makes sense because DataSource is a Singleton bean).

      This method is thread-safe

    • isDataSourceCreated

      @Deprecated public boolean isDataSourceCreated(String dataSourceName)
      Deprecated.
      This shouldn't be needed. Use AgroalDataSourceUtil.dataSourceIfActive(String) to check if a datasource is active.
    • getActiveDataSourceNames

      @Deprecated public Set<String> getActiveDataSourceNames()
    • getDataSource

      @Deprecated public io.agroal.api.AgroalDataSource getDataSource(String dataSourceName)
    • createDataSource

      public io.agroal.api.AgroalDataSource createDataSource(String dataSourceName, boolean otelEnabled)
      Deprecated, for removal: This API element is subject to removal in a future version.