...
An additional API should be added for users to provide custom injection modules to allow programmatic configuration of other injectable instances. This may be useful for unifying some ServiceLoader
-related APIs in Log4j. These modules can set up bindings for configurable classes outside the normal configuration system. For example, if injection begins from Log4jLoggerContext
, then these modules can be used for programmatically configuring a ContextSelector
and ShutdownCallbackRegistry
instead of relying on optional system properties to specify a class name. Programmatic configuration from a ServiceLoader
-created class simplifies class loading as direct references to classes can be compiled in directly. When injection begins from a LoggerContext
, modules can customize classes that are global to a configuration or logger context. This also provides a natural place to define or override ConfigurationFactory
instances. Other programmatic instances needed for various plugins can be more easily specified through this API.