Skip to content

Application Configuration


A utility to manage application configuration.


Binding name: p6.appconfig

Method: void save(String appKey, Map<String, Object> config)

Save the configuration defined in a key/value map.

The configuration is stored into a table AppConfig attached to the application appKey. The table will automatically be created if it does not exist.

Each value is converted to its string representation before being saved. The following types are supported :

  • String (default)
  • Double
  • Long
  • Integer
  • Float
  • Boolean
  • Byte
  • UUID
  • Date
  • ZonedDateTime
  • Character

If the type of the value does not match one of the previous types, the fallback conversion used will be the String.

Method: Object get(String appKey, String key)

Returns the configuration value

A P6Exception exception will be throw if:

  • the AppConfig table does not exist
  • there is no configuration entry for the specified key


Example 1

Save the initial configuration"p6_demo", [
    "description": "free text",
    "initialized": true,
    "version": 1

Example 2

Read configuration

def description = p6.appconfig.get("p6_demo", "description")
boolean initialized = p6.appconfig.get("p6_demo", "initialized")