I did some googling around and found my problem have appeared many times but i have tried all suggested solutions but it is still not working for me
I am keep getting this exception:
org.springframework.context.NoSuchMessageException: No message found under code 'error.null.firstname' for locale 'en'.
here is my setup in my dispatcher-servlet.xml file i have:
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value = "error"/>
</bean>
i have a properties file (error_en.properties) under src/main/resources/ directly and it does contain the following line:
error.null.firstname=Firstname cannot be null
in my code i am trying:
@Autowired
private MessageSource messageSource;
...
System.out.println(messageSource.getMessage("error.null.firstname", null, Locale.ENGLISH));
but above is not working and is giving me exception mentioned above
I've tried prefixing "classpath:" to 'value' in value attribute but that didn't work for me. I've ensured that the filename 'error' matches with the value attribute because i know '_en' would be dealt with by Spring Framework.
I can't see what am i missing?
src/main/resources/is in build path?