Class DatasourceConfiguration

  • All Implemented Interfaces:
    com.zaxxer.hikari.HikariConfigMXBean, BasicJdbcConfiguration

    @EachProperty(value="datasources",
                  primary="default")
    public class DatasourceConfiguration
    extends com.zaxxer.hikari.HikariConfig
    implements BasicJdbcConfiguration
    Allows the configuration of Hikari JDBC data sources. All properties on HikariConfig are available to be configured. If the url, driver class, username, or password are missing, sensible defaults will be provided when possible. If no configuration beyond the datasource name is provided, an in memory datastore will be configured based on the available drivers on the classpath.
    Since:
    1.0
    Author:
    James Kleeh
    • Constructor Detail

      • DatasourceConfiguration

        public DatasourceConfiguration​(@Parameter
                                       String name)
        Constructor.
        Parameters:
        name - name that comes from properties
    • Method Detail

      • getDriverClassName

        public String getDriverClassName()
        Specified by:
        getDriverClassName in interface BasicJdbcConfiguration
        Overrides:
        getDriverClassName in class com.zaxxer.hikari.HikariConfig
        Returns:
        The driver class name to be used by the data source
      • getUsername

        public String getUsername()
        Specified by:
        getUsername in interface BasicJdbcConfiguration
        Overrides:
        getUsername in class com.zaxxer.hikari.HikariConfig
        Returns:
        The username to be used by the data source
      • getPassword

        public String getPassword()
        Specified by:
        getPassword in interface BasicJdbcConfiguration
        Overrides:
        getPassword in class com.zaxxer.hikari.HikariConfig
        Returns:
        The password to be used by the data source
      • setValidationQuery

        public void setValidationQuery​(String validationQuery)
        Setter.
        Parameters:
        validationQuery - string of query
      • getJndiName

        public String getJndiName()
        Get Jndi name.
        Returns:
        jndiName
      • setJndiName

        public void setJndiName​(String jndiName)
        Setter.
        Parameters:
        jndiName - jndi name
      • setDataSourceProperties

        public void setDataSourceProperties​(@MapFormat(transformation=FLAT,keyFormat=RAW)
                                            Map<String,​?> dsProperties)
        Sets the data source properties.
        Specified by:
        setDataSourceProperties in interface BasicJdbcConfiguration
        Parameters:
        dsProperties - The datasource properties
      • setDataSourceProperties

        @Deprecated
        public void setDataSourceProperties​(Properties dsProperties)
        Deprecated.
        Overrides:
        setDataSourceProperties in class com.zaxxer.hikari.HikariConfig
        Parameters:
        dsProperties - The data source properties
      • isAutomaticValidationQuery

        public boolean isAutomaticValidationQuery()
        Returns:
        True if the validation query should be set automatically
      • setAutomaticValidationQuery

        public void setAutomaticValidationQuery​(boolean automaticValidationQuery)
        Set to true if the validation query should be set with an appropriate default value if not set manually.
        Parameters:
        automaticValidationQuery - Whether to auto set the validation query