Annotation Interface OnConfigReload


@Retention(RUNTIME) @Target(METHOD) public @interface OnConfigReload
Marks a method on a DI-managed bean to be invoked after a config is reloaded.

For a simple @Config target, the method may take zero parameters or accept the new config instance. For a folder-config target, it may take zero parameters or accept a FolderConfigItemChange<T> or FolderConfigSnapshot<T>.

It is not invoked on initial load, only on subsequent reloads. Place it on a bean, never on a @Config/@FolderConfig class itself (which is rejected at registration).

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Class<?>[]
    The config class(es) whose reloads this method reacts to.
  • Element Details

    • value

      Class<?>[] value
      The config class(es) whose reloads this method reacts to.

      If non-empty, the method is invoked only for reloads of the listed configs. If empty, the target is inferred from the method's parameter type (the config class, or the item type of a FolderConfigItemChange/FolderConfigSnapshot parameter); an empty value on a zero-parameter method listens to every registered config.

      Returns:
      the config classes to listen for, or an empty array to infer the target from the parameter (or to listen to any config when the method takes no parameter)
      Default:
      {}