Class DataStaxDriverSpringConfig

java.lang.Object
com.datastax.astra.boot.utils.DataStaxDriverSpringConfig

public class DataStaxDriverSpringConfig extends Object
Configuration Object.
  • Constructor Details

    • DataStaxDriverSpringConfig

      public DataStaxDriverSpringConfig()
  • Method Details

    • driverConfigFromSpring

      public static Map<String,String> driverConfigFromSpring(org.springframework.core.env.ConfigurableEnvironment env)
      Map that holds all driver configuration properties that have been set through a Spring properties mechanism. These can come from a properties file (or YAML or XML file), system properties, or some other mechanism by which Spring initializes properties.
      Parameters:
      env - current environment
      Returns:
      Map object with driver-related configuration property values.
    • mapAsTypeSafe

      public static String mapAsTypeSafe(String key)
      Converts a given key to one that can be used for backing a TypeSafe Config.

      For TypeSafe, list elements in a properties file are expected to be denoted by a property name that has an index appended as a path element. In a Spring properties file (or YML file), a list element, when converted to a String key, is represented by the key name followed by an index in square brackets.

      For example, if you have a property key called myList with 2 values in a list, Spring would yield the following two properties:

       myList[0]=value1
       myList[1]=value2
       

      TypeSafe wants them to look like this:

       myList.0=value1
       myList.1=value2
       

      This method converts any property key for list values form the way Spring builds them into the way TypeSafe expects them.

      Parameters:
      key - a Java map key the way Spring would create from various Spring PropertySources.
      Returns:
      a Java map key the way TypeSafe can parse them.