Annotation Interface ConfigurationDescription


@Retention(RUNTIME) @Target(TYPE) @Documented public @interface ConfigurationDescription
Classes specified as implementation for a component type may be annotated with a ConfigurationDescription. This description is used to automatically validate actual configurations at application (i.e. registry) startup. This tremendously simplifies the task of manual validation or makes it even unnecessary in some cases. But even manual validation can be performed by the means of a ConfigurationValidator before any instance of the component is actually created.

Currently, ConfigurationDescription on interfaces are not supported.

ConfigurationDescriptions are inherited from all ancestor classes (not implemented interfaces!). However, property declarations may not be overwritten or redefined. One reason is that the configuration is provided to the components in their constructor and it would not be possible to modify / adapt its property values before passing it on to the constructor of the superclass.

A ConfigurationDescription consists of zero or more Property descriptions and an optional ConfigurationValidator that will be used to verify the configuration at application startup.

TODO: should unknown properties in a configuration (not the description) trigger an exception? they should probably just trigger warnings in the logger since they're not harmful.
TODO: is more control needed over which properties are inherited from ancestor classes or even the overriding of properties? Adding restrictions and applying additional ConfigurationValidators shouldn't provide any problems.

Author:
Patrick Schmidt
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The configuration properties that are part of the configuration.
    The validator that will be used to verify the configuration at application startup before the component is instantiated.
  • Element Details

    • properties

      Property[] properties
      The configuration properties that are part of the configuration.
      Returns:
      the configuration properties that are part of the configuration
      Default:
      {}
    • validator

      Class<? extends ConfigurationValidator> validator
      The validator that will be used to verify the configuration at application startup before the component is instantiated. See ConfigurationValidator for more information.
      Returns:
      validator that will be used to verify the configuration
      Default:
      de.aristaflow.adept2.base.configuration.EmptyConfigurationValidator.class