I am really confused about part of my Thymeleaf configuration.
I have a properties file located at classpath:/messages/web.properties. In my configuration, the following is defined.
@Bean
public MessageSource messageSource() {
final ResourceBundleMessageSource messageSource;
messageSource = new ResourceBundleMessageSource();
messageSource.setDefaultEncoding("UTF-8");
messageSource.setBasename("messages/web");
return messageSource;
}
If I run the application with this configuration, everything works fine. Messages from the properties file are inserted into the Thymeleaf template (as expected).
But if I change the name of the method that creates the source of my message, restart my application and request the same page ... then the messages from my web.propertiesfile will not be found.
@Bean
public MessageSource webMessageSource() {
[...]
}
Why does the bean name (= method name) of a message resource affect my application?
Why is the message source webMessageSourcenot found using the Thymeleaf template engine?
user3529469