Currently, the spec does not forbid the field access strategy to be used for normal-scoped CDI beans (i.e. injected instances managed by the CDI container). However, this doesn't work because injectable references for normal-scoped beans are client proxies and not direct references to contextual instances (see also "6.5.3. Contextual reference for a bean" [1] and "5.4. Client proxies" [2]). The only solution would be to detect a client proxy and when encountered, use the underlying instance instead of attempting to validate the proxy object. Unfortunately, there is no portable way to detect and unwrap the client proxy. Moreover, there is no way in Java to delegate field access to the underlying instance - public fields are not allowed on normal-scoped CDI beans. So I would consider limiting support for validation of normal-scoped CDI beans. A note or a new entry in the FAQ might be enough.
[1] http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#contextual_reference [2] http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#client_proxies
|