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

Remko Popma commented on LOG4J2-653:
------------------------------------

I get how injection mechanisms work, but I'm not sure why introducing such a 
mechanism here is a good idea.
Guice or Spring supply a whole bunch of infrastructure to make this work, 
right? 

Wouldn't we need to create similar infrastructure to do the injecting? Sound 
like a non-trivial undertaking. Especially if the main use case is the unit 
tests.

In your above example the JUnit test explicitly calls 
{{builder.withFoo("foo").withBar("bar")}} and there is no magic and it is clear 
what is going on. I don't see how injection would improve things. (Actually I 
still don't see how this would work: the values to inject have to come from 
somewhere...  I cannot imagine what a JUnit test that uses injection would look 
like...)
Perhaps I'm just lacking in imagination.


> Add plugin builder classes as alternative to factory methods.
> -------------------------------------------------------------
>
>                 Key: LOG4J2-653
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-653
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Matt Sicker
>            Assignee: Matt Sicker
>              Labels: config
>
> It would be useful to have builder-style classes as an alternative to plugin 
> factory methods. This would be useful in two settings:
> # Easier to construct plugins in tests and in the code.
> # Can add annotations to fields for value injection in the PluginBuilder 
> class.
> This could replace the existing factory methods, or it could complement it. 
> This would also make it easier to support programmatic configuration.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to