1

デフォルトの ValidationMessages.properties を他のものに変更しようとしています。しかし、私はそれを理解していません。

私のセットアップ:

春に。

<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
    <property name="basenames">
        <list>
            <value>text</value>
            <value>error</value>
        </list>
    </property>
</bean>

<bean name="validator"
      class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
    <property name="validationMessageSource">
        <ref bean="messageSource"/>
    </property>
</bean>

text.properties および tex_XX.properties 内。

edit.profile.password.size=Password must be between {min} and {max}

注釈の例。

@Size(min=4, max=8, message="{edit.profile.password.size}")
4

1 に答える 1

0

別の検証プロバイダーを使用する場合でも、クラスパスに Hibernate Validator 4.1 以降が必要です。

于 2012-07-29T22:41:39.417 に答える