Matt Sicker created LOG4J2-2853:
-----------------------------------

             Summary: Add plugin/bean qualifiers to unify instance selection 
for dependency injection
                 Key: LOG4J2-2853
                 URL: https://issues.apache.org/jira/browse/LOG4J2-2853
             Project: Log4j 2
          Issue Type: New Feature
          Components: Core
            Reporter: Matt Sicker
            Assignee: Matt Sicker


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|https://docs.oracle.com/javaee/6/api/javax/inject/Inject.html], 
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).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to