Parent class for modules which use a typesafe config for values.
Parent class for modules which use a typesafe config for values. This automatically binds all
configuration values within a given Config instance, along with defaults from an optional
bundled config file. Each binding is annotated with @Named(configPath) to differentiate
multiple bindings for a single primitive type.
This will bind config (HOCON) value types boolean, number, string, list, and object. Boolean and
string entries are bound to the corresponding scala type. Numbers are bound to Double if they're
floating point, and are bound to Int, Long, and Double if they're integral. Lists are bound to
Seq[Config], since HOCON allows mixed list types. All object-valued keys are also bound as
Config instances.
The default config filename is looked for in the implementing class's path, using the resource
name module.conf. For example, if the implementing module is org.allenai.foobar.MyModule,
module.conf should be in src/main/resources/org/allenai/foobar. defaultConfig provides the
filename, if you want to change it from the default.
Parent class for modules which use a typesafe config for values. This automatically binds all configuration values within a given Config instance, along with defaults from an optional bundled config file. Each binding is annotated with
@Named(configPath)
to differentiate multiple bindings for a single primitive type.This will bind config (HOCON) value types boolean, number, string, list, and object. Boolean and string entries are bound to the corresponding scala type. Numbers are bound to Double if they're floating point, and are bound to Int, Long, and Double if they're integral. Lists are bound to Seq[Config], since HOCON allows mixed list types. All object-valued keys are also bound as Config instances.
The default config filename is looked for in the implementing class's path, using the resource name
module.conf
. For example, if the implementing module is org.allenai.foobar.MyModule,module.conf
should be insrc/main/resources/org/allenai/foobar
.defaultConfig
provides the filename, if you want to change it from the default.Example config and bindings:
Config file -
Injected Scala class -