question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Auto-Configure a MessageSource if a custom basename is set and no default properties file exists

See original GitHub issue

Hi, the Spring Boot propertie : spring.messages.basename=[directoy_in_resources]/messages does not work I have this arborescence in my project : image I have workaround this by write a :

    @Bean
    public MessageSource messageSource() {
        ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
        messageSource.setBasename("messages/messages");
        messageSource.setDefaultEncoding("UTF-8");
        return messageSource;
    }

But it’s seem a little heavy way, no ?

Why I can’t write this in application.properties :

spring.messages.basename=messages/messages

Thank’s for all

Rick

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
snicollcommented, Feb 24, 2021

Thanks @wilkinsona. Having a default properties file as a fallback being our recommendation is key in this, I think. I agree this would set a weird precedent and given things are properly documented in the reference guide, I agree we’re good with the current state.

0reactions
tarhackcommented, Feb 24, 2021

Ok, thank you all.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Spring Boot starter: how do you contribute i18n ...
basename property - it's not automatic. and; They must have their own messages.properties file in their application classpath. If a messages.
Read more >
Internationalization with Spring Boot REST - HowToDoInJava
We can customize the name of the resource bundle using property spring.messages.basename in application.properties file.
Read more >
Core Features - Spring
This section dives into the details of Spring Boot. Here you can learn about the key features that you may want to use...
Read more >
A Custom Auto-Configuration with Spring Boot - Baeldung
An application that uses the MySQLAutoconfiguration may need to override the default properties. In this case, it just needs to add different ...
Read more >
The Grails Framework 4.0.0
GORM 7 and Hibernate 5.4 (now the default version of Hibernate for new ... Starting from Spring Boot 2.0, the addResources property no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found