org.springframework.context.support.ResourceBundleMessageSource.setAlwaysUseMessageFormat()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(67)

本文整理了Java中org.springframework.context.support.ResourceBundleMessageSource.setAlwaysUseMessageFormat方法的一些代码示例,展示了ResourceBundleMessageSource.setAlwaysUseMessageFormat的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceBundleMessageSource.setAlwaysUseMessageFormat方法的具体详情如下:
包路径:org.springframework.context.support.ResourceBundleMessageSource
类名称:ResourceBundleMessageSource
方法名:setAlwaysUseMessageFormat

ResourceBundleMessageSource.setAlwaysUseMessageFormat介绍

暂无

代码示例

代码示例来源:origin: cn.bestwu.simpleframework/simpleframework-core

@Bean
public MessageSource messageSource() {
 MessageSourceProperties properties = messageSourceProperties();
 ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
 if (StringUtils.hasText(properties.getBasename())) {
  messageSource.setBasenames(StringUtils.commaDelimitedListToStringArray(
    StringUtils.trimAllWhitespace(properties.getBasename())));
 }
 if (properties.getEncoding() != null) {
  messageSource.setDefaultEncoding(properties.getEncoding().name());
 }
 messageSource.setFallbackToSystemLocale(properties.isFallbackToSystemLocale());
 Duration cacheDuration = properties.getCacheDuration();
 if (cacheDuration != null) {
  messageSource.setCacheMillis(cacheDuration.toMillis());
 }
 messageSource.setAlwaysUseMessageFormat(properties.isAlwaysUseMessageFormat());
 messageSource.setUseCodeAsDefaultMessage(properties.isUseCodeAsDefaultMessage());
 return messageSource;
}

代码示例来源:origin: com.blossom-project/blossom-autoconfigure

@Bean
@Primary
public MessageSource messageSource( BlossomReloadableResourceBundleMessageSource parentMmessageSource) {
 MessageSourceProperties properties = messageSourceProperties();
 ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
 if (StringUtils.hasText(properties.getBasename())) {
  messageSource.setBasenames(StringUtils.commaDelimitedListToStringArray(
   StringUtils.trimAllWhitespace(properties.getBasename())));
 }
 if (properties.getEncoding() != null) {
  messageSource.setDefaultEncoding(properties.getEncoding().name());
 }
 messageSource.setFallbackToSystemLocale(properties.isFallbackToSystemLocale());
 Duration cacheDuration = properties.getCacheDuration();
 messageSource.setCacheSeconds(
  cacheDuration == null ? -1 : (int) cacheDuration.getSeconds());
 messageSource.setAlwaysUseMessageFormat(properties.isAlwaysUseMessageFormat());
 messageSource.setUseCodeAsDefaultMessage(properties.isUseCodeAsDefaultMessage());
 messageSource.setParentMessageSource(parentMmessageSource);
 return messageSource;
}

代码示例来源:origin: cn.bestwu.simpleframework/simpleframework-web

@Bean
public MessageSource messageSource(ApplicationContext applicationContext) {
 MessageSourceProperties properties = messageSourceProperties(applicationContext);
 ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
 if (StringUtils.hasText(properties.getBasename())) {
  messageSource.setBasenames(StringUtils.commaDelimitedListToStringArray(
    StringUtils.trimAllWhitespace(properties.getBasename())));
 }
 if (properties.getEncoding() != null) {
  messageSource.setDefaultEncoding(properties.getEncoding().name());
 }
 messageSource.setFallbackToSystemLocale(properties.isFallbackToSystemLocale());
 Duration cacheDuration = properties.getCacheDuration();
 if (cacheDuration != null) {
  messageSource.setCacheMillis(cacheDuration.toMillis());
 }
 messageSource.setAlwaysUseMessageFormat(properties.isAlwaysUseMessageFormat());
 messageSource.setUseCodeAsDefaultMessage(properties.isUseCodeAsDefaultMessage());
 return messageSource;
}

相关文章

微信公众号

最新文章

更多