[richfaces-issues] [JBoss JIRA] (RF-12041) BeanValidator: no way to use BeanValidation with a custom config

Markus Staab (JIRA) jira-events at lists.jboss.org
Wed Mar 14 04:55:48 EDT 2012


    [ https://issues.jboss.org/browse/RF-12041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12676629#comment-12676629 ] 

Markus Staab commented on RF-12041:
-----------------------------------

same problem when bootstrapping the pre-configuration like this.

{code}
      ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
      ValidatorContext validatorContext = validatorFactory.usingContext();
      validatorContext.messageInterpolator( new DpdResourceBundle() );
{code}
                
> BeanValidator: no way to use BeanValidation with a custom config
> ----------------------------------------------------------------
>
>                 Key: RF-12041
>                 URL: https://issues.jboss.org/browse/RF-12041
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 3.3.3.Final
>         Environment: Liferay 5.2.4, Portlet 2.0, JSF 1.2
>            Reporter: Markus Staab
>
> The BeanValidator class bootstraps a whole new BeanValidation context in its constructor:
> {code} 
> BeanValidator() {
> 		// Enforce class to load
> 		ValidatorFactory.class.getName();
> 		// Check Factory, to avoid instantiation errors
> 		// https://jira.jboss.org/jira/browse/RF-7226
> 		validatorFactory = Validation
> 					.buildDefaultValidatorFactory();
> 		validatorContext = validatorFactory.usingContext();
> 		MessageInterpolator jsfMessageInterpolator = new JsfMessageInterpolator(
> 				validatorFactory.getMessageInterpolator());
> 		validatorContext.messageInterpolator(jsfMessageInterpolator);
> 	}
> {code} 
> because of this, there is no way to use the programmatic configuration feature of BeanValidation.
> I tried to pre-configure a custom MessageInterpolator with
> {code} 
>       Configuration<?> config = Validation.byDefaultProvider().configure();
>       config.messageInterpolator( new MyInterpolator() );
> {code} 
> but this configuration change is not taken into account by the BeanValidator of Richfaces.
> ATM the only way to achive this sort of customization is to use a META-INF/validation.xml

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the richfaces-issues mailing list