I am currently working on an CDI extension. I have to register some special custom beans, thats why a producer is not sufficient.
This is currently done inside the AfterBeanDiscovery
-Phase by registering a custom implementation of Bean<>
using the abd.addBean()
method.
The drawback is that inside the create()
-method of the bean I can't access the InjectionPoint
, that may contain additional configuration inside an annotation.
As a possibility I could collect all beans I need in the ProcessInjectionTarget
phase (as there I have access to the annotations) and register each of them inside the AfterBeanDiscovery
phase.
Then I would have to make the configuration annotation a qualifier and the attributes of the qualifier binding (not using @Nonbinding
) to prevent ambigous dependencies.
But then I will register a huge amount of beans that just are different in their configuration.
Is there an alternate solution? Is it possible to access the InjectionPoint
inside the beans create()
method?
Thank you!