Class PlatformPlaceholderDatabaseDriverResolver

java.lang.Object
org.springframework.boot.jdbc.init.PlatformPlaceholderDatabaseDriverResolver

public class PlatformPlaceholderDatabaseDriverResolver extends Object
Utility class that can resolve placeholder text with the actual DatabaseDriver platform.

By default, the name of the platform is the ID of the driver. This mapping can be customized by withDriverPlatform(DatabaseDriver, String) registering custom DatabaseDriver to platform mappings.

Since:
2.6.0
Author:
Phillip Webb, Andy Wilkinson
  • Constructor Details

    • PlatformPlaceholderDatabaseDriverResolver

      public PlatformPlaceholderDatabaseDriverResolver()
      Creates a new resolver that will use the default "@@platform@@" placeholder.
    • PlatformPlaceholderDatabaseDriverResolver

      public PlatformPlaceholderDatabaseDriverResolver(String placeholder)
      Creates a new resolver that will use the given placeholder.
      Parameters:
      placeholder - the placeholder to use
  • Method Details

    • withDriverPlatform

      public PlatformPlaceholderDatabaseDriverResolver withDriverPlatform(DatabaseDriver driver, String platform)
      Creates a new PlatformPlaceholderDatabaseDriverResolver that will map the given driver to the given platform.
      Parameters:
      driver - the driver
      platform - the platform
      Returns:
      the new resolver
    • resolveAll

      public List<String> resolveAll(DataSource dataSource, String... values)
      Resolves the placeholders in the given values, replacing them with the platform derived from the DatabaseDriver of the given dataSource.
      Parameters:
      dataSource - the DataSource from which the DatabaseDriver is derived
      values - the values in which placeholders are resolved
      Returns:
      the values with their placeholders resolved
      See Also:
    • resolveAll

      public List<String> resolveAll(String platform, String... values)
      Resolves the placeholders in the given values, replacing them with the given platform.
      Parameters:
      platform - the platform to use
      values - the values in which placeholders are resolved
      Returns:
      the values with their placeholders resolved
      Since:
      2.6.2