Interface GuiceyConfigurationHook

  • All Known Implementing Classes:
    DiagnosticHook
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface GuiceyConfigurationHook
    Guicey configuration hook used to amend application configuration. Primarily intended to be used in tests with GuiceyHooksRule (junit) and UseGuiceyHooks (spock).

    Hook could be registered with register() method call.

    Hooks are thread-scoped: it is assumed that registration thread is the same thread where application will start.

    Hooks could be enabled with a system property "guicey.hooks". Property value must contain comma-separated list of complete hook class names. Each hook in list must have default no-args constructor. Example: -Dguicey.hooks=com.foo.MyHook1,com.foo.MyHook2. Aliases may be assigned to simplify hooks enabling GuiceBundle.Builder.hookAlias(String, Class).

    Enabling hooks from system property may be used for enabling reporting or additional tooling on already compiled applications. For example, bundled DiagnosticHook could enable guicey diagnostic reports (enabled during development with print* methods on GuiceBundle) with system property: -Dguicey.hooks=diagnostic.

    Since:
    11.04.2018
    See Also:
    GuiceyHooksRule, UseGuiceyHooks