0

i am using hibernate validation (4.2.0 Final) with JSF 2 and Spring and here's my configuration:

1- applicationContext:

<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    <property name="basenames">
    <list>

    <value>classpath:messages/ValidationMessages</value>
    <value>classpath:messages/application</value>

    </list>
    </property>
    <property name="defaultEncoding" value="UTF-8"/>
    </bean> 

2- faces-config.xml:

<resource-bundle>
           <base-name>messages.ValidationMessages</base-name>
        </resource-bundle>

when trying to use the following:

@NotBlank(message = "{name.required}")
private String name;

it doesn't work, it doesn't display the message from property file, it displays {name.required}

please advise why it's not working.

4
  • AFAIR hibernate-validator always looking for ValidationMessages in root of classpath. I suggest to move it there. Commented Nov 8, 2011 at 6:34
  • it's already in classpath, i think that i am missing additional configuration. Commented Nov 9, 2011 at 6:34
  • I was talking about root of classpath, because in your example ValidationMessages inside message directory. Commented Nov 9, 2011 at 7:27
  • aha, got you, i will try that. Commented Nov 9, 2011 at 14:18

1 Answer 1

1

problem was that ValidationMessages.properties is not under the classpath directly, i was putting it inside a messages folder in the classpath, when i moved it to be under classpath directly it works fine now.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.