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

Abierto
#2,769 44 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@jaykataria1111 ya está trabajando en esto.

Desde el 3/11/2024.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

good first issue plugins waiting-for-maintainer

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.

Lenguaje dominante
Java
Estrellas
3.6k
Forks
1.8k
Merge medio
5 d 6 h
PR fusionados (30 d)
24

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/logging-log4j2

Todos los issues de apache/logging-log4j2

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.