Class PlatformPlaceholderDatabaseDriverResolver
java.lang.Object
org.springframework.boot.jdbc.init.PlatformPlaceholderDatabaseDriverResolver
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 Summary
ConstructorDescriptionCreates a new resolver that will use the default"@@platform@@"
placeholder.PlatformPlaceholderDatabaseDriverResolver
(String placeholder) Creates a new resolver that will use the givenplaceholder
. -
Method Summary
Modifier and TypeMethodDescriptionresolveAll
(String platform, String... values) Resolves the placeholders in the givenvalues
, replacing them with the given platform.resolveAll
(DataSource dataSource, String... values) Resolves the placeholders in the givenvalues
, replacing them with the platform derived from theDatabaseDriver
of the givendataSource
.withDriverPlatform
(DatabaseDriver driver, String platform) Creates a newPlatformPlaceholderDatabaseDriverResolver
that will map the givendriver
to the givenplatform
.
-
Constructor Details
-
PlatformPlaceholderDatabaseDriverResolver
public PlatformPlaceholderDatabaseDriverResolver()Creates a new resolver that will use the default"@@platform@@"
placeholder. -
PlatformPlaceholderDatabaseDriverResolver
Creates a new resolver that will use the givenplaceholder
.- Parameters:
placeholder
- the placeholder to use
-
-
Method Details
-
withDriverPlatform
public PlatformPlaceholderDatabaseDriverResolver withDriverPlatform(DatabaseDriver driver, String platform) Creates a newPlatformPlaceholderDatabaseDriverResolver
that will map the givendriver
to the givenplatform
.- Parameters:
driver
- the driverplatform
- the platform- Returns:
- the new resolver
-
resolveAll
Resolves the placeholders in the givenvalues
, replacing them with the platform derived from theDatabaseDriver
of the givendataSource
.- Parameters:
dataSource
- the DataSource from which theDatabaseDriver
is derivedvalues
- the values in which placeholders are resolved- Returns:
- the values with their placeholders resolved
-
resolveAll
Resolves the placeholders in the givenvalues
, replacing them with the given platform.- Parameters:
platform
- the platform to usevalues
- the values in which placeholders are resolved- Returns:
- the values with their placeholders resolved
- Since:
- 2.6.2
-