Class DatasourceFactory
java.lang.Object
io.micronaut.configuration.jdbc.hikari.DatasourceFactory
- All Implemented Interfaces:
AutoCloseable
Creates a Hikari data source for each configuration bean.
- Since:
- 1.0
- Author:
- James Kleeh, Christian Oestreich
-
Constructor Summary
ConstructorDescriptionDatasourceFactory
(io.micronaut.context.ApplicationContext applicationContext) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
dataSource
(DatasourceConfiguration datasourceConfiguration) Method to wire up all the HikariCP connections based on theDatasourceConfiguration
.
-
Constructor Details
-
DatasourceFactory
public DatasourceFactory(io.micronaut.context.ApplicationContext applicationContext) Default constructor.- Parameters:
applicationContext
- The application context
-
-
Method Details
-
dataSource
@Context @EachBean(DatasourceConfiguration.class) public DataSource dataSource(DatasourceConfiguration datasourceConfiguration) Method to wire up all the HikariCP connections based on theDatasourceConfiguration
. If aMeterRegistry
bean exists then the registry will be added to the datasource.- Parameters:
datasourceConfiguration
- ADatasourceConfiguration
- Returns:
- A
HikariUrlDataSource
-
close
@PreDestroy public void close()- Specified by:
close
in interfaceAutoCloseable
-