Class DatasourceFactory
java.lang.Object
io.micronaut.configuration.jdbc.tomcat.DatasourceFactory
- All Implemented Interfaces:
AutoCloseable
Creates a tomcat data source for each configuration bean.
- Since:
- 1.0
- Author:
- James Kleeh, Christian Oestreich
-
Constructor Summary
ConstructorDescriptionDatasourceFactory
(@Nullable DataSourceResolver dataSourceResolver) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
dataSource
(DatasourceConfiguration datasourceConfiguration) tomcatPoolDataSourceMetadataProvider
(DataSource dataSource) Method to create a metadata object that allows pool value lookup for each datasource object.
-
Constructor Details
-
DatasourceFactory
Default constructor.- Parameters:
dataSourceResolver
- The data source resolver
-
-
Method Details
-
dataSource
@Context @EachBean(DatasourceConfiguration.class) public DataSource dataSource(DatasourceConfiguration datasourceConfiguration) - Parameters:
datasourceConfiguration
- ADatasourceConfiguration
- Returns:
- An Apache Tomcat
DataSource
-
tomcatPoolDataSourceMetadataProvider
@EachBean(javax.sql.DataSource.class) @Requires(beans=DatasourceConfiguration.class) public TomcatDataSourcePoolMetadata tomcatPoolDataSourceMetadataProvider(DataSource dataSource) Method to create a metadata object that allows pool value lookup for each datasource object.- Parameters:
dataSource
- The datasource- Returns:
- a
TomcatDataSourcePoolMetadata
-
close
@PreDestroy public void close()- Specified by:
close
in interfaceAutoCloseable
-