java – I18n Springboot from an external library

Question:

Gentlemen, on my system I have an external component that contains the messagesource bean configured as follows:

@Bean
public ReloadableResourceBundleMessageSource messageSource() {
    final ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
    source.setBasename("classpath:i18n/core/messages");
    source.setDefaultEncoding("UTF-8");
    source.setUseCodeAsDefaultMessage(true);
    return source;
}

However I need the exception messages to be displayed in the application that is importing it, something that is not happening:

br.com.mv.liberty.editor3core.exception.vo.StudioException: group.length.max.description

How should I configure my application to display messages from this embedded component?

Answer:

How baseName is source.setBasename("classpath:i18n/core/messages"); , you need to place the messages.properties file into the following directory:

 src/main/resources/i18n/core/message.properties
Scroll to Top