@Factory public class DatasourceFactory extends Object implements AutoCloseable
Constructor and Description |
---|
DatasourceFactory(io.micronaut.context.ApplicationContext applicationContext)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
DataSource |
dataSource(DatasourceConfiguration datasourceConfiguration)
Method to wire up all the HikariCP connections based on the
DatasourceConfiguration . |
public DatasourceFactory(io.micronaut.context.ApplicationContext applicationContext)
applicationContext
- The application context@Context @EachBean(value=DatasourceConfiguration.class) public DataSource dataSource(DatasourceConfiguration datasourceConfiguration)
DatasourceConfiguration
.
If a MeterRegistry
bean exists then the registry will be added to the datasource.datasourceConfiguration
- A DatasourceConfiguration
HikariUrlDataSource
@PreDestroy public void close()
close
in interface AutoCloseable