Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2853

Add plugin/bean qualifiers to unify instance selection for dependency injection

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0
    • Core
    • None

    Description

      In the 2.x plugin API, we have numerous ways of specifying metadata to a variable or performing manual configuration tree traversal in order to resolve the value of that variable from the user configuration. These include most of the @Plugin annotations as well as some system properties.

      In the 3.0 API, we should unify this into a "qualifier" concept. A plugin/bean can contain one or more qualifiers which are specified by annotations and matched at runtime to the injection target qualifiers. Qualifiers are inspired by the corresponding concept in javax.inject, though they shouldn't be limited to only one qualifier on an injection target or plugin/bean. Like in CDI, multiple qualifiers should be allowed to be specified.

      Within a scope (LOG4J2-2852), plugins/beans will have at most one instance per unique set of qualifiers. Qualifiers will typically be placed on plugin classes or on injection targets, while configuration trees will emit specially qualified plugins/beans for injection into Core plugins which take injected parameters. Existing plugin annotations should be updated to work as corresponding qualifiers without requiring code updates on the plugin side (even though this will allow us to simplify and clean up various parts of our own code base over time).

      Attachments

        Activity

          People

            mattsicker Matt Sicker
            mattsicker Matt Sicker
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: