Thanks for your prompt reply Pitor, but I think we have a misunderstanding
here.

For one, my problem is not simply about `@RequiredClass`, Jackson, etc. I
can solve this with a hardcoded if/else clause in JTL. My point is: there
are places in the code where plugins are loaded, they all employ different
injection mechanisms, and these vary in the way they work. Matt's effort
will fix this and as a bonus improve the plugin infra.

Regarding your suggestion about `ServiceLoaderUtil`... If we are not gonna
use plugins because there is a bug and rather implement an
actually-should-be-working-via-2.x-plugins functionality in a totally
different way (please correct me if I misunderstood you), I doubt if this
qualifies as a fix more than a bug. I want to introduce a structural
solution to a bigger problem rather than trying to merely ship LOG4J2-3082.

Let me repeat one more time to make my point more tangible:
`JsonTemplateLayout`, `PatternLayout`, etc. use `PluginManager` to load
plugins. Though PM doesn't offer many of the functionality offered while
loading `TypeConverter`s, which are plugins themselves too. There are
competing injectors and they are not aligned in features they provide.

On Mon, Apr 18, 2022 at 8:56 PM Piotr P. Karwasz <piotr.karw...@gmail.com>
wrote:

> Hi Volcan,
>
> On Sun, 17 Apr 2022 at 22:42, Volkan Yazıcı <vol...@yazi.ci> wrote:
>
> >    1. I was working on LOG4J2-3082 (support external serializers, e.g.,
> >    Jackson, in JTL) and there I needed `@RequiredClass`. Ralph already
> >    implemented this in `master`, I just need to copy it to `release-2.x`,
> >    after all it is just a `@ConstraintValidator`, right? Right... But it
> >    simply won't work. Because JTL, as `PatternLayout`, uses
> > `PluginManager` to
> >    load plugins and that doesn't support `@ConstraintValidator` et al.?!
> > I've
> >    discussed this with Matt and we came to the conclusion that porting
> the
> > new
> >    plugin infra from 3.x to 2.x is easier compared to fixing the problem
> in
> >    2.x.
> >
>
> Maybe this can be solved in other ways. For example we could have a:
> 1. `SerializerFactory` with multiple implementations each one in a separate
> module,
> 2. You use the `ServiceLoaderUtil` to find an implementation or you use the
> internal one if there are none.
>
> I think that the dependency injector is a feature that should stay in 3.0
> to motivate people to move from 2.x.
>
> Piotr
>

Reply via email to