この回答HibernateValidatorで指定されているように、フォームの「password」と「confirmPassword」の 2 つのフィールドが等しいかどうかを検証しています。以下は、制約記述子(バリデータ インターフェイス) です。
package constraintdescriptor;
import constraintvalidator.FieldMatchValidator;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.TYPE;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
@Target({TYPE, ANNOTATION_TYPE})
@Retention(RUNTIME)
@Constraint(validatedBy = FieldMatchValidator.class)
@Documented
public @interface FieldMatch
{
    String message() default "{constraintdescriptor.fieldmatch}";
    Class<?>[] groups() default {};
    Class<? extends Payload>[] payload() default {};
    /**
     * @return The first field
     */
    String first();
    /**
     * @return The second field
     */
    String second();
    /**
     * Defines several <code>@FieldMatch</code> annotations on the same element
     *
     * @see FieldMatch
     */
    @Target({TYPE, ANNOTATION_TYPE})
    @Retention(RUNTIME)
    @Documented
    public @interface List{
        FieldMatch[] value();
    }
}
以下は、制約バリデーター(実装クラス) です。
package constraintvalidator;
import constraintdescriptor.FieldMatch;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import org.apache.commons.beanutils.BeanUtils;
public final class FieldMatchValidator implements ConstraintValidator<FieldMatch, Object>
{
    private String firstFieldName;
    private String secondFieldName;
    public void initialize(final FieldMatch constraintAnnotation) {
        firstFieldName = constraintAnnotation.first();
        secondFieldName = constraintAnnotation.second();
        //System.out.println("firstFieldName = "+firstFieldName+"   secondFieldName = "+secondFieldName);
    }
    public boolean isValid(final Object value, final ConstraintValidatorContext cvc) {
        try {
            final Object firstObj = BeanUtils.getProperty(value, firstFieldName );
            final Object secondObj = BeanUtils.getProperty(value, secondFieldName );
            //System.out.println("firstObj = "+firstObj+"   secondObj = "+secondObj);
            return firstObj == null && secondObj == null || firstObj != null && firstObj.equals(secondObj);
        }
        catch (final Exception e) {
            System.out.println(e.toString());
        }
        return true;
    }
}
以下は、JSP ページ (タグで指定)commandName="tempBean"にマップされたバリデーター Bean です。<form:form></form:form>
package validatorbeans;
import constraintdescriptor.FieldMatch;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.NotEmpty;
@FieldMatch.List({
    @FieldMatch(first = "password", second = "confirmPassword", message = "The password fields must match", groups={TempBean.ValidationGroup.class})
})
public final class TempBean
{        
    @NotEmpty(groups={ValidationGroup.class}, message="Might not be left blank.")
    private String password;
    @NotEmpty(groups={ValidationGroup.class}, message="Might not be left blank.")
    private String confirmPassword;
    public interface ValidationGroup {};
    //Getters and setters                
}
アップデート
すべて正しく機能しており、意図した検証を行っています。1 つだけ残っているのは、指定されたエラー メッセージをTempBeanクラスの上に表示することです。@FieldMatchつまり、1 つだけ質問 があります。検証違反が発生したときに JSP ページにエラー メッセージを表示するにはどうすればよいですか? 
@NotEmpty(両方のフィールドpasswordとクラスの注釈が機能しconfirmPassword、TempBean違反時に指定されたメッセージが表示されます。これは では起こりません@FieldMatch)。
このブログで指定されているように、この質問に基づいて検証グループを使用していますが、エラーメッセージの表示が中断されることはありません (そう思われるかもしれません)。
JSP ページでは、これら 2 つのフィールドは次のように指定されます。
<form:form id="mainForm" name="mainForm" method="post" action="Temp.htm" commandName="tempBean">
    <form:password path="password"/>
    <font style="color: red"><form:errors path="password"/></font><br/>
    <form:password path="confirmPassword"/>
    <font style="color: red"><form:errors path="confirmPassword"/></font><br/>
</form:form>