Auto-Configure a MessageSource if a custom basename is set and no default properties file exists
See original GitHub issueHi,
the Spring Boot propertie :
spring.messages.basename=[directoy_in_resources]/messages does not work
I have this arborescence in my project :
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:
- Created 3 years ago
- Comments:13 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
Ok, thank you all.