use of org.springframework.context.support.ResourceBundleMessageSource in project kylo by Teradata.
the class SparkShellClientAppCommonConfig method sparkShellMessages.
@Bean
public MessageSource sparkShellMessages() {
final ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasename("spark-shell");
messageSource.setUseCodeAsDefaultMessage(true);
return messageSource;
}
use of org.springframework.context.support.ResourceBundleMessageSource in project entando-core by entando.
the class AbstractControllerTest method createExceptionResolver.
protected ExceptionHandlerExceptionResolver createExceptionResolver() {
final ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasename("rest/messages");
messageSource.setUseCodeAsDefaultMessage(true);
ExceptionHandlerExceptionResolver exceptionResolver = new ExceptionHandlerExceptionResolver() {
@Override
protected ServletInvocableHandlerMethod getExceptionHandlerMethod(HandlerMethod handlerMethod, Exception exception) {
Method method = new ExceptionHandlerMethodResolver(RestExceptionHandler.class).resolveMethod(exception);
RestExceptionHandler validationHandler = new RestExceptionHandler();
validationHandler.setMessageSource(messageSource);
return new ServletInvocableHandlerMethod(validationHandler, method);
}
};
exceptionResolver.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
exceptionResolver.afterPropertiesSet();
return exceptionResolver;
}
use of org.springframework.context.support.ResourceBundleMessageSource in project kylo by Teradata.
the class CatalogConfig method catalogMessages.
@Bean
public MessageSource catalogMessages() {
final ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasename("CatalogMessages");
messageSource.setUseCodeAsDefaultMessage(true);
return messageSource;
}
use of org.springframework.context.support.ResourceBundleMessageSource in project kylo by Teradata.
the class SparkShellRestConfig method sparkShellMessages.
@Bean
public MessageSource sparkShellMessages() {
final ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasenames("spark-shell", "spark-shell-plugin");
messageSource.setUseCodeAsDefaultMessage(true);
return messageSource;
}
use of org.springframework.context.support.ResourceBundleMessageSource in project spring-boot by spring-projects.
the class MessageSourceAutoConfiguration method messageSource.
@Bean
public MessageSource messageSource() {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
if (StringUtils.hasText(this.basename)) {
messageSource.setBasenames(StringUtils.commaDelimitedListToStringArray(StringUtils.trimAllWhitespace(this.basename)));
}
if (this.encoding != null) {
messageSource.setDefaultEncoding(this.encoding.name());
}
messageSource.setFallbackToSystemLocale(this.fallbackToSystemLocale);
messageSource.setCacheSeconds(this.cacheSeconds);
messageSource.setAlwaysUseMessageFormat(this.alwaysUseMessageFormat);
return messageSource;
}
Aggregations