Using
injectionPoint.getMember().getDeclaringClass()
works for me in WildFly 10.1.0, and I also quickly tested it on Payara Server 4.1.1.162 #badassfish (build 116). I also did a test on the brand new Payara 4.1.1.164 #badassfish server (build 28). However, I had to change the scope of the bean manufacturer to @ApplicationScoped. The default area did not work. In my case, it even makes sense :)
injectionPoint.getBean().getBeanClass()
Method
worked for me in the old Payara, but not in the new WildFly 10.1.0.Final and the new Payara server 4.1.1.164 #badassfish (build 28).
If you look at Payara, the current new version 164 contains Weld 2.4.0.Final and WildFly 10.1.0Final uses version 2.3.5.Final. In both versions, the classic code does not work!
Conclusion: it works on older CDI (Weld) implementations. In some newer Weld (introduced in Payara 161), the behavior has changed. I do not know whether it is intentional or not.
However, the solution should use
injectionPoint.getMember().getDeclaringClass()
and annotate bean maker with
@javax.enterprise.context.ApplicationScoped
annotations.
user1930502
source share