org.springframework.context.NoSuchMessageException: No message found under code ‘user.username.empty’ for locale ‘en_GB’.
Currently I have the following code:
applicationContext.xml:
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource"
p:basename="messages" />
What I’m trying to do is cause an error to appear for the user if when they try and register on my site with a blank username, it will give them the error defined as user.username.empty. My application is working as intended and it’s looking for the error user.username.empty, however it cannot find it no matter where I put the properties file.
What folder do I need to put the properties file and how do I need it named?
It must be named
messages.properties, and be in the classpath, in the default package. And it must of course contain such a line:You may customize it for
en_GBby using a file namedmessages_en_GB.properties, in the same location.