Package io.micronaut.r2dbc
Class DefaultBasicR2dbcProperties
java.lang.Object
io.micronaut.r2dbc.DefaultBasicR2dbcProperties
- All Implemented Interfaces:
io.micronaut.core.naming.Named
,BasicR2dbcProperties
@EachProperty(value="r2dbc.datasources",
primary="default")
public class DefaultBasicR2dbcProperties
extends Object
implements BasicR2dbcProperties
Abstract implementation of
BasicR2dbcProperties
.- Since:
- 1.0.0
- Author:
- graemerocher
-
Field Summary
Fields inherited from interface io.micronaut.r2dbc.BasicR2dbcProperties
PREFIX
-
Constructor Summary
ModifierConstructorDescriptionprotected
DefaultBasicR2dbcProperties
(String name, io.micronaut.context.env.Environment environment) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionio.r2dbc.spi.ConnectionFactoryOptions.Builder
builder()
io.r2dbc.spi.ConnectionFactoryOptions.Builder
getName()
protected static io.r2dbc.spi.ConnectionFactoryOptions.Builder
newConnectionFactoryOptionsBuilder
(String name, io.micronaut.context.env.Environment env, @Nullable String defaultUrl) Create aConnectionFactoryOptions.Builder
from the configured URL if present.setConnectTimeout
(Duration duration) Sets the connect timeout.setDatabase
(@NotBlank String database) Sets the initial database name.Sets the driver.Sets the host.setOptions
(@Nullable Map<String, String> options) Sets the connection properties.setPassword
(CharSequence password) Sets the password.setPort
(@jakarta.validation.constraints.Positive int port) Sets the port.setProtocol
(@NotBlank String protocol) Sets the protocol.setSsl
(boolean ssl) Sets whether to prefer SSL configuration.setUsername
(@NotBlank String username) Sets the username.
-
Constructor Details
-
DefaultBasicR2dbcProperties
protected DefaultBasicR2dbcProperties(@Parameter String name, io.micronaut.context.env.Environment environment) Default constructor.- Parameters:
name
- The name of the datasourceenvironment
- The environment
-
-
Method Details
-
builder
@NonNull public io.r2dbc.spi.ConnectionFactoryOptions.Builder builder()- Specified by:
builder
in interfaceBasicR2dbcProperties
- Returns:
- Return the current builder
-
setDriver
Sets the driver.- Specified by:
setDriver
in interfaceBasicR2dbcProperties
- Parameters:
driver
- The driver- Returns:
- These properties
-
setOptions
public BasicR2dbcProperties setOptions(@MapFormat(keyFormat=RAW) @Nullable @Nullable Map<String, String> options) Sets the connection properties.- Specified by:
setOptions
in interfaceBasicR2dbcProperties
- Parameters:
options
- The options- Returns:
- These properties
-
setProtocol
Sets the protocol.- Specified by:
setProtocol
in interfaceBasicR2dbcProperties
- Parameters:
protocol
- The protocol- Returns:
- These properties
-
setConnectTimeout
Sets the connect timeout.- Specified by:
setConnectTimeout
in interfaceBasicR2dbcProperties
- Parameters:
duration
- The duration- Returns:
- These properties
-
setSsl
Sets whether to prefer SSL configuration.- Specified by:
setSsl
in interfaceBasicR2dbcProperties
- Parameters:
ssl
- Sets whether to prefer SSL- Returns:
- These properties
-
newConnectionFactoryOptionsBuilder
protected static io.r2dbc.spi.ConnectionFactoryOptions.Builder newConnectionFactoryOptionsBuilder(String name, io.micronaut.context.env.Environment env, @Nullable @Nullable String defaultUrl) Create aConnectionFactoryOptions.Builder
from the configured URL if present.- Parameters:
name
- The name of the datasourceenv
- The environmentdefaultUrl
- The default URL to use- Returns:
- The builder
-
getName
- Specified by:
getName
in interfaceio.micronaut.core.naming.Named
-
getBuilder
public io.r2dbc.spi.ConnectionFactoryOptions.Builder getBuilder()- Returns:
- The connection factory options builder.
-
setHost
Sets the host.- Specified by:
setHost
in interfaceBasicR2dbcProperties
- Parameters:
host
- The host- Returns:
- These properties
-
setPort
Sets the port.- Specified by:
setPort
in interfaceBasicR2dbcProperties
- Parameters:
port
- The port- Returns:
- These properties
-
setUsername
Sets the username.- Specified by:
setUsername
in interfaceBasicR2dbcProperties
- Parameters:
username
- The username- Returns:
- These properties
-
setPassword
Sets the password.- Specified by:
setPassword
in interfaceBasicR2dbcProperties
- Parameters:
password
- The password- Returns:
- These properties
-
setDatabase
Sets the initial database name.- Specified by:
setDatabase
in interfaceBasicR2dbcProperties
- Parameters:
database
- The database- Returns:
- These properties
-