Property Interpolation

Interpolation in this context means the substitution of variables into strings. GeoServer app-schema supports the interpolation of properties (the Java equivalent of environment variables) into app-schema mapping files. This can be used, for example, to simplify the management of database connection parameters that would otherwise be hardcoded in a particular mapping file. This enables data directories to be given to third parties without inapplicable authentication or system configuration information. Externalising these parameters make management easier.

Defining properties

  • If the system property is not set, properties are loaded from WEB-INF/classes/ (or another resource / on the classpath).

  • If the system property is set, properties are loaded from the file named as the value of the property. This is principally intended for debugging, and is designed to be used in an Eclipse launch configuration.

    • For example, if the JVM is started with, properties are loaded from /path/to/some/
  • System properties override properties defined in a configuration file, so if you define at the java command line, it will override a value specified in the file. This is intended for debugging, so you can set a property file in an Eclipse launch configuration, but override some of the properties contained in the file by setting them explicitly as system properties.

  • All system properties are available for interpolation in mapping files.

Using properties

  • Using ${} anywhere in the mapping file will cause it to be replaced by the value of the property
  • It is an error for a property that has not been set to be used for interpolation.
  • Interpolation is performed repeatedly, so values can contain new interpolations. Use this behaviour with caution because it may cause an infinite loop.
  • Interpolation is performed before XML parsing, so can be used to include arbitrary chunks of XML.

Example of property interpolation

This example defines an Oracle data store, where the connection parameter are interpolated from properties:


Example property file

This sample property file gives the property values that are interpolated into the mapping file fragment above. These properties can be installed in WEB-INF/classes/ in your GeoServer installation: =
example.database = example
example.user = dbuser
example.passwd = s3cr3t