Package io.micronaut.jdbc
Class CalculatedSettings
java.lang.Object
io.micronaut.jdbc.CalculatedSettings
A class used to fill in the missing gaps of information needed
to successfully configure a data source.
- Since:
- 1.0
- Author:
- James Kleeh
-
Constructor Summary
ConstructorDescriptionCalculatedSettings
(BasicJdbcConfiguration basicJdbcConfiguration) CalculatedSettings
(BasicJdbcConfiguration basicJdbcConfiguration, ClassLoader classLoader) -
Method Summary
Modifier and TypeMethodDescriptionDetermines the driver class name based on the configured value.Determines the password based on the configured value.getUrl()
Determines the URL based on the configured value.Determines the username based on the configured value.Determines the validation query based on the configured value.
-
Constructor Details
-
CalculatedSettings
- Parameters:
basicJdbcConfiguration
- The basic jdbc configuration
-
CalculatedSettings
- Parameters:
basicJdbcConfiguration
- The basic jdbc configurationclassLoader
- The classloader to get the embedded database connection from
-
-
Method Details
-
getDriverClassName
Determines the driver class name based on the configured value. If not configured, determine the driver class name based on the URL. If the URL is not configured, look for an embedded database driver on the classpath.- Returns:
- The calculated driver class name
-
getUrl
Determines the URL based on the configured value. If the URL is not configured, search for an embedded database driver on the classpath and retrieve a default URL for it.- Returns:
- The calculated URL
-
getUsername
Determines the username based on the configured value. If the username is not configured and an embedded database driver is on the classpath, return 'sa'.- Returns:
- The calculated username
-
getPassword
Determines the password based on the configured value. If the password is not configured and an embedded database driver is on the classpath, return an empty string.- Returns:
- The calculated password
-
getValidationQuery
Determines the validation query based on the configured value. If the validation query is not configured, search pre-defined databases for a match based on the URL. If a match is found, return the defined validation query for that database.- Returns:
- The calculated validation query
-