ConnectionFactory based on a set of ConnectionFactoryOptions.
This utility provides runtime discovery of R2DBC implementations that are available through the class path. A ConnectionFactory can be obtained in two ways:
get(String)get(ConnectionFactoryOptions)r2dbc:a-driver:pipes://localhost:3306/my_database?locale=en_US \___/ \______/ \___/ \____________/\__________/\___________/ | | | | | | scheme driver protocol authority path query
scheme: Identify that the URL is a valid R2DBC URL. Valid schemes are r2dbc and r2dbcs (configure SSL usage).
driver: Identifier for a driver. The specification has no authority over driver identifiers.
protocol: Used as optional protocol information to configure a driver-specific protocol. Protocols can be organized hierarchically and are separated by a colon (:).
authority: Contains an endpoint and authorization. The authority may contain a single host or a collection of hostnames and port tuples by separating these with a comma (,).
path: (optional) Used as an initial schema or database name.
query: (optional) Used to pass additional configuration options in the form of String key-value pairs by using the key name as the option name.
fragment: Unused (reserved for future use).
Example usage:
ConnectionFactory factory = ConnectionFactories.get("r2dbc:a-driver:pipes://localhost:3306/my_database?locale=en_US");
ConnectionFactory LookupConnectionFactory can be requested by providing a ConnectionFactoryOptions object to ConnectionFactories#get(ConnectionFactoryOptions). ConnectionFactoryOptions
can be built using a builder from ConnectionFactoryOptions tuples. Once created, ConnectionFactoryOptions is immutable.
Example usage:
ConnectionFactoryOptions options = ConnectionFactoryOptions.builder()
.option(ConnectionFactoryOptions.DRIVER, "a-driver")
.option(ConnectionFactoryOptions.PROTOCOL, "pipes")
.option(ConnectionFactoryOptions.HOST, "localhost")
.option(ConnectionFactoryOptions.PORT, 3306)
.option(ConnectionFactoryOptions.DATABASE, "my_database")
.option(Option.valueOf("locale"), "en_US")
.build();
ConnectionFactory factory = ConnectionFactories.get(options);
ConnectionFactoryOptions, ConnectionFactoryOptions#parse(CharSequence), ServiceLoader
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static ConnectionFactory | find(ConnectionFactoryOptions
a collection of connectionFactoryOptions)ConnectionFactoryOptionsReturns a |
| public static ConnectionFactory | Returns: the createdConnectionFactorythe R2DBC connection url url)Returns a |
| public static ConnectionFactory | Returns: the createdConnectionFactorya collection of connectionFactoryOptions)ConnectionFactoryOptionsReturns a |
| private static String | |
| private static ServiceLoader | |
| public static boolean | Returns: true if a ConnectionFactory can be created from a collection of ConnectionFactoryOptions, false otherwise.a collection of connectionFactoryOptions)ConnectionFactoryOptionsReturns whether a |
| ConnectionFactories | back to summary |
|---|---|
| private ConnectionFactories() | |
| find | back to summary |
|---|---|
| public static ConnectionFactory find(ConnectionFactoryOptions connectionFactoryOptions) Returns a
| |
| get | back to summary |
|---|---|
| public static ConnectionFactory get(String url) Returns a
| |
| get | back to summary |
|---|---|
| public static ConnectionFactory get(ConnectionFactoryOptions connectionFactoryOptions) Returns a
| |
| getAvailableDrivers | back to summary |
|---|---|
| private static String getAvailableDrivers() | |
| loadProviders | back to summary |
|---|---|
| private static ServiceLoader | |
| supports | back to summary |
|---|---|
| public static boolean supports(ConnectionFactoryOptions connectionFactoryOptions) Returns whether a
| |