You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Matt Sicker (Jira)" <ji...@apache.org> on 2022/01/17 21:10:00 UTC

[jira] [Commented] (LOG4J2-2854) Create standardized dependency injection API

    [ https://issues.apache.org/jira/browse/LOG4J2-2854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17477418#comment-17477418 ] 

Matt Sicker commented on LOG4J2-2854:
-------------------------------------

This is in master, though it's still under development.

> Create standardized dependency injection API
> --------------------------------------------
>
>                 Key: LOG4J2-2854
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2854
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: Core
>            Reporter: Matt Sicker
>            Assignee: Matt Sicker
>            Priority: Major
>
> In the 2.x plugin API, we do not have a generic dependency injection mechanism. We do have a similar system in Configuration for injection configuration data into Core plugins. There are other attempts at user configuration injection into other classes through system properties as well.
> In the 3.0 API, a more generic and unified dependency injection API should be provided. This should be analogous to how the [standard javax.inject API|https://docs.oracle.com/javaee/6/api/javax/inject/Inject.html] works. This should include a way to specify how a class can be instantiated through either {{@Inject}} on the constructor or {{@Produces}} on a method. The produces version should replace the existing methods of binding configuration data to the  {{@Plugin(Builder)Factory}} annotations. Combined with scopes (LOG4J2-2852) and qualifiers (LOG4J2-2853), this will allow for a lot of code in log4j-core to be refactored to remove boilerplate code related to object construction and lifecycle management.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)