java.lang.Object
org.springframework.boot.docker.compose.service.connection.jdbc.JdbcUrlBuilder

public class JdbcUrlBuilder extends Object
Utility used to build a JDBC URL for a RunningService.
Since:
3.1.0
Author:
Moritz Halbritter, Andy Wilkinson, Phillip Webb
  • Constructor Details

    • JdbcUrlBuilder

      public JdbcUrlBuilder(String driverProtocol, int containerPort)
      Create a new JdbcUrlBuilder instance.
      Parameters:
      driverProtocol - the driver protocol
      containerPort - the source container port
  • Method Details

    • build

      public String build(RunningService service)
      Build a JDBC URL for the given RunningService.
      Parameters:
      service - the running service
      Returns:
      a new JDBC URL
    • build

      public String build(RunningService service, String database)
      Build a JDBC URL for the given RunningService and database.
      Parameters:
      service - the running service
      database - the database to connect to
      Returns:
      a new JDBC URL
    • appendParameters

      protected void appendParameters(StringBuilder url, String parameters)
      Appends to the given url the given parameters.

      The default implementation appends a ? followed by the parameters.

      Parameters:
      url - the url
      parameters - the parameters
      Since:
      3.2.7