fromDataSource
Initializes DataAccess using an existing DataSource.
This method provides fine-grained control over the initialization process and is suitable for environments where the DataSource is managed externally (e.g., by a DI container like Spring or a JavaEE application server).
The initialization sequence includes:
Core Type Initialization: Ensures framework-specific types (like
dynamic_dto) exist.Database Migrations: Runs optional user-defined migrations via migrationRunner.
Type Registry Loading: Scans the database and classpath to build a type metadata map.
Converter Setup: Initializes bidirectional Kotlin-to-PostgreSQL mapping logic.
Return
A fully initialized DataAccess instance.
Parameters
The pre-configured DataSource to use for all database operations.
List of package names to scan for annotated classes (@PgEnum, @PgComposite, etc.).
List of database schemas to scan for type definitions.
Strategy for handling Dynamic DTO serialization. Defaults to DynamicDtoSerializationStrategy.AUTOMATIC_WHEN_UNAMBIGUOUS.
If true, skip ensuring framework-specific types exist.
If true, prints the Octavius banner to standard output upon successful initialization.
Optional custom transaction manager. Defaults to DefaultJdbcTransactionProvider.
Optional factory for creating dedicated connections for LISTEN/NOTIFY. If null, a default strategy is used (direct DriverManager for Hikari, otherwise directly from DataSource).
Optional callback executed when the returned DataAccess is closed.