Announcement Announcement Module
Collapse
No announcement yet.
MessageSource Unable to find Resource Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MessageSource Unable to find Resource

    Hi,

    I am not sure why it is unable to find the resources. Anyone have a solution?
    Code:
    WARN : org.springframework.context.support.ResourceBundleMessageSource - 
    ResourceBundle [/WEB-INF/i18n/messages] not found for MessageSource: 
    Can't find bundle for base name /WEB-INF/i18n/data, locale en_..
    
    WARN : org.springframework.context.support.ResourceBundleMessageSource - 
    ResourceBundle [/WEB-INF/i18n/application] not found for MessageSource: 
    Can't find bundle for base name /WEB-INF/i18n/app, locale en_..
    
    @Bean
    public MessageSource messageSource(){
    	ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
        messageSource.setBasenames("/WEB-INF/i18n/data","/WEB-INF/i18n/app");
        return messageSource;
    }
    
    I also tried placing i18n folder into "src/main/resources/ " with no luck

  • #2
    Change the configuration of your message source bean to:

    Code:
    @Bean
    public MessageSource messageSource() {
            ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
    
            messageSource.setBasename("i18n/messages");
           
            return messageSource;
    }
    Put your properties file in to a directory: src/main/resources/i18n

    Comment

    Working...
    X