Dogyman
Dogyman

Reputation: 31

Spring MessageSource basename path problems

I am currently working on a Spring Project and want to link my messages.properties in a @Bean to enable UTF-8 Encoding.

This is my project structure:

Project Structure

And this is the Bean in the ServletInitializer.java:

@Bean
ReloadableResourceBundleMessageSource messageSource() {
    ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
    source.setDefaultEncoding("UTF-8");
    source.setBasename("messages");
    return source;
}

However, when I run this my website dows not show the messages but rather their id's (codes):

??catalog.title_de??

What would be the correct way of showing it the path to my messages?

Upvotes: 0

Views: 3018

Answers (1)

Thomas Kåsene
Thomas Kåsene

Reputation: 5449

Without knowing much more about your project, I think I can only suggest setting basename to classpath:messages instead of messages.

Upvotes: 1

Related Questions