As discussed on Zulip, it would come in handy if there was some convenient injection support in QuarkusTestResourceLifecycleManager.
Today you are on own since you only get the testInstance in inject() and you have to do all the hard reflection work yourself.
Implementation ideas
In a backward-compatible way, a new inject(BasicInjector injector) method could be introduced.
That BasicInbjector (or whatever its name is) wraps the test instance and could provide some basic convenience methods like:
injectIntoFields(Class<?> type, Object value) (or with <T>)
Description
As discussed on Zulip, it would come in handy if there was some convenient injection support in
QuarkusTestResourceLifecycleManager
. Today you are on own since you only get thetestInstance
ininject()
and you have to do all the hard reflection work yourself.Implementation ideas
In a backward-compatible way, a new
inject(BasicInjector injector)
method could be introduced. ThatBasicInbjector
(or whatever its name is) wraps the test instance and could provide some basic convenience methods like:injectIntoFields(Class<?> type, Object value)
(or with<T>
)injectIntoFields(Class<? extends Annotation> type, Object value)
https://github.com/quarkusio/quarkus/issues/18698
$upstream:18698$