本文整理汇总了Java中org.springframework.context.support.ReloadableResourceBundleMessageSource.setUseCodeAsDefaultMessage方法的典型用法代码示例。如果您正苦于以下问题:Java ReloadableResourceBundleMessageSource.setUseCodeAsDefaultMessage方法的具体用法?Java ReloadableResourceBundleMessageSource.setUseCodeAsDefaultMessage怎么用?Java ReloadableResourceBundleMessageSource.setUseCodeAsDefaultMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.context.support.ReloadableResourceBundleMessageSource
的用法示例。
在下文中一共展示了ReloadableResourceBundleMessageSource.setUseCodeAsDefaultMessage方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: messageSource
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean(name = "messageSource")
public MessageSource messageSource() {
// MessageSource configuration for localized messages.
final ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
source.setBasenames("classpath:/i18n/messages", "classpath:ValidationMessages");
source.setUseCodeAsDefaultMessage(true);
source.setFallbackToSystemLocale(false);
source.setDefaultEncoding(StandardCharsets.ISO_8859_1.name());
if (runtimeEnvironmentUtil.isDevelopmentEnvironment()) {
// Check for updates on every refresh, otherwise cache forever
source.setCacheSeconds(1);
}
return source;
}
示例2: apiErrorMessageSource
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean(name = "apiErrorMessageSource")
public ReloadableResourceBundleMessageSource apiErrorMessageSource() {
ReloadableResourceBundleMessageSource messageBundle = new ReloadableResourceBundleMessageSource();
messageBundle.setBasename("classpath:error_messages");
messageBundle.setDefaultEncoding("UTF-8");
messageBundle.setUseCodeAsDefaultMessage(true);
return messageBundle;
}
示例3: messageSource
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Primary
@Bean(name = "messageSource")
public ReloadableResourceBundleMessageSource messageSource() { // @todo not working
ReloadableResourceBundleMessageSource messageBundle = new ReloadableResourceBundleMessageSource();
messageBundle.setBasename("classpath:messages");
messageBundle.addBasenames("classpath:messages", "classpath:validation");
messageBundle.setUseCodeAsDefaultMessage(true);
messageBundle.setDefaultEncoding("UTF-8");
messageBundle.setFallbackToSystemLocale(true);
return messageBundle;
}
示例4: getMessageSource
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
private static MessageSource getMessageSource()
{
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
messageSource.setBasenames("classpath:/messages");
messageSource.setUseCodeAsDefaultMessage(true);
messageSource.setDefaultEncoding("UTF-8");
messageSource.setCacheSeconds(0);
return messageSource;
}
示例5: getMessageSource
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean
public ReloadableResourceBundleMessageSource getMessageSource() {
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
messageSource.setDefaultEncoding("UTF-8");
messageSource.setBasename("classpath:locale/messages");
messageSource.setUseCodeAsDefaultMessage(true);
return messageSource;
}
示例6: messageSource
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean
public MessageSource messageSource() {
ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
source.setBasename("classpath:/io/lavagna/i18n/messages");
source.setUseCodeAsDefaultMessage(true);
source.setFallbackToSystemLocale(false);
return source;
}
示例7: reloadableResourceBundleMessageSource
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean
public ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource() {
ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
//TODO: Move that values to properties
source.setBasenames("/WEB-INF/locale/imcms", "/WEB-INF/locale/image_archive");
source.setFallbackToSystemLocale(false);
source.setUseCodeAsDefaultMessage(true);
return source;
}
示例8: initMessageSource
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
private static MessageSource initMessageSource() {
final ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
messageSource.setCacheSeconds(5);
messageSource.setDefaultEncoding("UTF-8");
messageSource.setFallbackToSystemLocale(true);
messageSource.setUseCodeAsDefaultMessage(false);
messageSource.setBasename("classpath:messages");
return messageSource;
}