quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.86k stars 2.71k forks source link

QuarkusComponentTest: support simplified constructor injection #43339

Open mkouba opened 2 months ago

mkouba commented 2 months ago

Description

QuarkusComponentTest does not support bytecode transformations yet and thus simplified constructor injection does not work.

Implementation ideas

We'll need something like https://github.com/quarkusio/quarkus/pull/35473 first to be able to implement this feature.

quarkus-bot[bot] commented 2 months ago

/cc @Ladicek (arc), @manovotn (arc)

holly-cummins commented 2 months ago

Popping this into the test classloading working group backlog. We can take it back out if we decide that's not a logical home for it. #34681 carefully avoids touching anything to do with @ComponentTest (and seems to be mostly getting away with it, in terms of not breaking those tests). However, thinking about it, I think the basic 'load tests with the classloader used to run them' approach should extend nicely to this scenario.

If someone was brave enough to start prototyping, in #34681 I think the natural hook point is in FacadeClassLoader. Adding something for component tests in there would allow the classloading to be intercepted, which would then allow pre-execution bytecode manipulation. But at the moment #34681 makes @Ladicek's changeset look like a model of pretty, clean code, so waiting a little while longer for #34681 to settle and become less ugly makes sense.