-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent behavior when finding unproxyable bean #673
Comments
I wanted to take a closer look into this issue and investigation in Weld code as I had the suspicion that I am missing some use case here. What I realized is that CDI specification determines proxyability based on bean types and not beans as such. As an example, consider the following bean:
Now, let's have the following injection point:
The specification in its current wording allows this to work even if the actual bean implementation is not proxyable. Here is an old Weld JIRA which also mentioned this - https://issues.redhat.com/browse/WELD-1052 Mind that the above is true for client proxies and if the bean ( One other note from my original comment was that the container is required to sometimes treat this as a deployment error and at other times throw Given all of the above, I will close this issue and remove it from the milestone. |
Recently, I was looking into how CDI spec defines what happens if you find an unproxyable bean and it seems to me that there cases in which it behaves rather weirdly and I thought we could improve that.
There are two key parts to this. Firstly, there is a definition of unproxyable bean which states the following:
In which case it leads to:
However, the above only applies if an injection point resolves to a bean.
There is another section in the spec that states:
Why doesn't the spec just throw deployment exception for all unproxyable beans? You have the whole set of beans known at deployment time (or, in case of Lite, possibly in build time).
Few notes:
UnproxyableResolutionException
only for client proxies - proxyability due to interception/decoration is unaffected and will still throw a deployment exception even if no injection point resolves to this beanUnproxyableResolutionException
is also used inInterceptionFactory
, where it is thrown in case the bean is unproxyable for whatever reason - interception subclass includedInterceptionFactory
during deploymentUnproxyableManagedBeanTest
Could we change this behavior to early detection and deployment error for all beans?
Is there a use case I am missing that this explicit spec statement covers?
The text was updated successfully, but these errors were encountered: