]
Gunnar Morling updated SEAMVALIDATE-7:
--------------------------------------
Status: Resolved (was: Pull Request Sent)
ConstraintValidator instances created incorrectly
-------------------------------------------------
Key: SEAMVALIDATE-7
URL:
https://issues.jboss.org/browse/SEAMVALIDATE-7
Project: Seam Validation
Issue Type: Bug
Affects Versions: 3.0.0.CR1
Reporter: Jozef Hartinger
Assignee: Gunnar Morling
Priority: Critical
Fix For: 3.0.0.Final
The current way of creating a ConstraintValidator instance is not correct:
{code}
AnnotatedType<T> type = beanManager.createAnnotatedType(key);
InjectionTarget<T> it = beanManager.createInjectionTarget(type);
CreationalContext<T> ctx = beanManager.createCreationalContext(null);
T instance = it.produce(ctx);
it.inject(instance, ctx);
it.postConstruct(instance);
return instance;
{code}
Since an AnnotatedType and InjectionTarget are created for every ConstraintValidator
creation, it is not possible for a thirdparty extension to wrap these metadata during
container startup. The correct way of creating a ConstraintValidator instance would be:
{code}
Set<Bean<?>> beans = beanManager.getBeans(key);
Bean<?> bean = beanManager.resolve(beans);
CreationalContext<?> ctx = beanManager.createCreationalContext(bean);
return (T) beanManager.getReference(bean, key, ctx);
{code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: