Spring Support of ExtVal

It's possible to provide a validation strategy as Spring bean.


//The name of annotation: @CustomRequired

//Part of the Spring configuration:

<bean id="customRequiredValidationStrategy" class="..." lazy-init="true">
    <property name="messageResolver" ref="customMsgResolver"/>
    <property name="requiredValidationService" ref="demoRequiredValidationService"/>

<bean id="customMsgResolver" class="org.apache.myfaces.extensions.validator.core.validation.message.resolver.DefaultValidationErrorMessageResolver" lazy-init="true">
    <!-- With JSF 1.2 you can use the var name of resource-bundle see faces-config.xml -->
    <property name="messageBundleVarName" value="messages"/>

<bean id="demoRequiredValidationService" class="..."/>

The bean name follows the available name conventions.
(Also custom name conventions are supported.)

A simple demo is available here: demo_106

Furthermore, it's possible to provide a Meta-Data Transformer as Spring bean.

Spring 3

As alternative there is an add-on for Spring 3 and the BV integration (= ExtVal validation module) to allow typesafe dependency injection in constraint validators.

Extensions/Validator/ExtVal_and_Spring (last edited 2010-03-10 11:13:59 by 81-223-16-114)