org.springframework.boot.r2dbc

Class ConnectionFactoryBuilder

  • java.lang.Object
    • org.springframework.boot.r2dbc.ConnectionFactoryBuilder


  • public final class ConnectionFactoryBuilder
    extends java.lang.Object
    Builder for ConnectionFactory.
    Since:
    2.5.0
    • Method Detail

      • withOptions

        public static ConnectionFactoryBuilder withOptions(io.r2dbc.spi.ConnectionFactoryOptions.Builder options)
        Initialize a new ConnectionFactoryBuilder based on the specified options.
        Parameters:
        options - the options to use to initialize the builder
        Returns:
        a new builder initialized with the settings defined in the given options
      • derivefrom

        @Deprecated
        public static ConnectionFactoryBuilder derivefrom(io.r2dbc.spi.ConnectionFactory connectionFactory)
        Deprecated. since 2.5.1 for removal in 2.7.0 in favor of derivedFrom(ConnectionFactory)
        Initialize a new ConnectionFactoryBuilder derived from the options of the specified connectionFactory.
        Parameters:
        connectionFactory - the connection factory whose options are to be used to initialize the builder
        Returns:
        a new builder initialized with the options from the connection factory
      • derivedFrom

        public static ConnectionFactoryBuilder derivedFrom(io.r2dbc.spi.ConnectionFactory connectionFactory)
        Initialize a new ConnectionFactoryBuilder derived from the options of the specified connectionFactory.
        Parameters:
        connectionFactory - the connection factory whose options are to be used to initialize the builder
        Returns:
        a new builder initialized with the options from the connection factory
        Since:
        2.5.1
      • configure

        public ConnectionFactoryBuilder configure(java.util.function.Consumer<io.r2dbc.spi.ConnectionFactoryOptions.Builder> options)
        Configure additional options.
        Parameters:
        options - a Consumer to customize the options
        Returns:
        this for method chaining
      • username

        public ConnectionFactoryBuilder username(java.lang.String username)
        Configure the username.
        Parameters:
        username - the connection factory username
        Returns:
        this for method chaining
      • password

        public ConnectionFactoryBuilder password(java.lang.CharSequence password)
        Configure the password.
        Parameters:
        password - the connection factory password
        Returns:
        this for method chaining
      • hostname

        public ConnectionFactoryBuilder hostname(java.lang.String host)
        Configure the host name.
        Parameters:
        host - the connection factory hostname
        Returns:
        this for method chaining
      • port

        public ConnectionFactoryBuilder port(int port)
        Configure the port.
        Parameters:
        port - the connection factory port
        Returns:
        this for method chaining
      • database

        public ConnectionFactoryBuilder database(java.lang.String database)
        Configure the database.
        Parameters:
        database - the connection factory database
        Returns:
        this for method chaining
      • build

        public io.r2dbc.spi.ConnectionFactory build()
        Build a ConnectionFactory based on the state of this builder.
        Returns:
        a connection factory
      • buildOptions

        public io.r2dbc.spi.ConnectionFactoryOptions buildOptions()
        Build a ConnectionFactoryOptions based on the state of this builder.
        Returns:
        the options