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
ConstructorsModifierConstructorDescriptionprotectedDefaultBasicR2dbcProperties(String name, io.micronaut.context.env.Environment environment) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionio.r2dbc.spi.ConnectionFactoryOptions.Builderbuilder()io.r2dbc.spi.ConnectionFactoryOptions.BuildergetName()protected static io.r2dbc.spi.ConnectionFactoryOptions.BuildernewConnectionFactoryOptionsBuilder(String name, io.micronaut.context.env.Environment env, @Nullable String defaultUrl) Create aConnectionFactoryOptions.Builderfrom 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:
builderin interfaceBasicR2dbcProperties- Returns:
- Return the current builder
-
setDriver
Sets the driver.- Specified by:
setDriverin 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:
setOptionsin interfaceBasicR2dbcProperties- Parameters:
options- The options- Returns:
- These properties
-
setProtocol
Sets the protocol.- Specified by:
setProtocolin interfaceBasicR2dbcProperties- Parameters:
protocol- The protocol- Returns:
- These properties
-
setConnectTimeout
Sets the connect timeout.- Specified by:
setConnectTimeoutin interfaceBasicR2dbcProperties- Parameters:
duration- The duration- Returns:
- These properties
-
setSsl
Sets whether to prefer SSL configuration.- Specified by:
setSslin 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.Builderfrom 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:
getNamein 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:
setHostin interfaceBasicR2dbcProperties- Parameters:
host- The host- Returns:
- These properties
-
setPort
Sets the port.- Specified by:
setPortin interfaceBasicR2dbcProperties- Parameters:
port- The port- Returns:
- These properties
-
setUsername
Sets the username.- Specified by:
setUsernamein interfaceBasicR2dbcProperties- Parameters:
username- The username- Returns:
- These properties
-
setPassword
Sets the password.- Specified by:
setPasswordin interfaceBasicR2dbcProperties- Parameters:
password- The password- Returns:
- These properties
-
setDatabase
Sets the initial database name.- Specified by:
setDatabasein interfaceBasicR2dbcProperties- Parameters:
database- The database- Returns:
- These properties
-