[weld-dev] Do Custom implementations of Bean need to provide injection points?
Martin Kouba
mkouba at redhat.com
Fri Aug 4 07:05:25 EDT 2017
Hi John,
Bean.getInjectionPoints() is only used during validation - returned
injection points are validated at initialization time, so for a custom
bean it makes sense to return an empty set as there are no real
injection points.
WRT lookup - what exactly do you try to accomplish? Do you try to obtain
InjectionPoint metadata from inside a custom dependent bean's create()
method? This should be possible although not clearly specified. I think
we have a test with BeanManager.getInjectableReference(InjectionPoint,
CreationalContext<?>) but I will need to double check.
I will also look at the geronimo-config repo.
Martin
Dne 4.8.2017 v 11:42 John D. Ament napsal(a):
> Hi
>
> As the subject says. I have a library that registers a custom
> implementation of Bean, which has a method
>
> @Override
> public Set<InjectionPoint> getInjectionPoints() {
> return Collections.emptySet();
> }
>
> When testing this on Weld3, I have code that looks up the injection
> point, to find the annotations present. However, the following
> injection point lookup fails:
>
> private static InjectionPoint findInjectionPoint(final BeanManager
> bm, final CreationalContext<?> ctx) {
> return InjectionPoint.class.cast(
>
> bm.getReference(bm.resolve(bm.getBeans(InjectionPoint.class)),
> InjectionPoint.class, ctx));
> }
>
> so based on a CreationalContext I'm looking for InjectionPoint. Maybe
> there's a different way that this is supposed to work? If you're
> interested in giving it a shot, take a look at
> https://github.com/apache/geronimo-config and run the Weld3 profile to
> replicate the issue.
>
> John
>
>
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev
>
--
Martin Kouba
Senior Software Engineer
Red Hat, Czech Republic
More information about the weld-dev
mailing list