Interface ConfigModifier<C extends io.dropwizard.core.Configuration>

Type Parameters:
C - configuration type
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 ConfigModifier<C extends io.dropwizard.core.Configuration>
Configuration modifier is an alternative for configuration override, which is limited for simple property types (for example, a collection could not be overridden).

Modifier is called before application run phase. Only logger configuration is applied at this moment (and so you can't change it). Modifier would work with both yaml and instance-based configurations.

Could be declared in: - ExtensionBuilder.configModifiers(ConfigModifier[]) extension builder (same for dropwizard extension) - TestGuiceyApp.configModifiers() extension annotation (same for dropwizard annotation) - TestSupport.build(Class) - generic test support object builder - TestSupport.buildCommandRunner(Class) - generic test command runner - GuiceyTestSupport.configModifiers(ConfigModifier[]) - guicey support object (directly) - CommandTestSupport.configModifiers(ConfigModifier[]) - command support object (directly)

To enable support for DropwizardTestSupport custom command factory must be used: ConfigOverrideUtils.buildCommandFactory(java.util.List).

Since:
04.03.2025
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    modify(C config)
    Called before application run phase.
  • Method Details

    • modify

      void modify(C config) throws Exception
      Called before application run phase. Only logger configuration is applied at this moment (and so you can't change it). Modifier would work with both yaml and instance-based configurations.
      Parameters:
      config - configuration instance
      Throws:
      Exception - on error (to avoid try-catch blocks in modifier itself)