apache / apache/logging-log4j2

Replace field injection with setter injection in `3.x`

Open
#2,769 44 comments 0 reactions 1 assignee Claimed by @jaykataria1111 View on GitHub
good first issue plugins waiting-for-maintainer
Dominant language
Java
Stars
3.6k
Forks
1.7k
Avg merge
21h 30m
Merged PRs (30d)
27

Description

As issue #2766 shows, there are still some Log4j plugin builders that don't have setters for all their configuration attributes.

Since field injection becomes more problematic in newer Java version, I believe we should add the missing setters and make sure all new attributes come with a public setter.

Therefore I propose:

* to modify the annotation processor in `2.x` to fail if a plugin builder attribute does not have a public setter (or at least a wither).
* fix the compilation errors in `2.x`.

Regarding `3.x` I would prefer to remove field injection completely from `log4j-plugins` and use builders and setter injection everywhere. IMHO our DI subsystem does not need to have all the features of a fully-fledged DI.
Obviously we might still need field injection if we want to support all the existing `2.x` plugins, but I would still love a 200 KiB dependency injection system.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.