本文整理汇总了Java中org.springframework.context.support.ReloadableResourceBundleMessageSource.setBasename方法的典型用法代码示例。如果您正苦于以下问题:Java ReloadableResourceBundleMessageSource.setBasename方法的具体用法?Java ReloadableResourceBundleMessageSource.setBasename怎么用?Java ReloadableResourceBundleMessageSource.setBasename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.context.support.ReloadableResourceBundleMessageSource
的用法示例。
在下文中一共展示了ReloadableResourceBundleMessageSource.setBasename方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: messageSource
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean(name = "messageSource")
public ReloadableResourceBundleMessageSource messageSource() {
ReloadableResourceBundleMessageSource messageBundle = new ReloadableResourceBundleMessageSource();
messageBundle.setBasename("classpath:messages/messages");
messageBundle.setDefaultEncoding("UTF-8");
return messageBundle;
}
示例2: initMessageSource
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@PostConstruct
protected void initMessageSource() {
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
messageSource.setBasename("classpath:messages/conversation");
messageSource.setDefaultEncoding("utf-8");
messageSource.setCacheSeconds(3600);
if (externalResourceBundle != null) {
ReloadableResourceBundleMessageSource external = new ReloadableResourceBundleMessageSource();
external.setBasename(externalResourceBundle);
external.setDefaultEncoding("utf-8");
external.setCacheSeconds(500);
external.setParentMessageSource(messageSource);
this.messageSource = external;
} else {
this.messageSource = messageSource;
}
}
示例3: messageSource
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean(name = "messageSource")
public MessageSource messageSource() {
ReloadableResourceBundleMessageSource reloadMessage = new ReloadableResourceBundleMessageSource();
reloadMessage.setBasename("classpath:/messages");
reloadMessage.setDefaultEncoding("UTF-8");
reloadMessage.setCacheSeconds(0);
return reloadMessage;
}
示例4: shouldReturnTheFormattedLocalizedMessage
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Test
public void shouldReturnTheFormattedLocalizedMessage() {
CurrentLocale locale = new CurrentLocale();
ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
source.setBasename("test_message");
MessageSourceAccessor accessor = new MessageSourceAccessor(source);
Localizer localizer = new Localizer(accessor, locale);
assertThat(localizer.localize("hello_world"), is("Hello World"));
locale.setLocaleString(Localizer.LOCALE_ENGLISH_US);
assertThat(localizer.localize("MY_HOME", "San Francisco"), is("My home is San Francisco"));
locale.setLocaleString(Localizer.LOCALE_KANNADA);
assertThat(localizer.localize("MY_HOME", "ಬೆಂಗಳೂರು"), is("ನಮ್ಮ ಊರು ಬೆಂಗಳೂರು"));
locale.setLocaleString(Localizer.LOCALE_KANNADA);
assertThat(localizer.localize("MY_BIRTHDAY", new DateTime(1984, 12, 23, 14, 0, 0, 0, DateTimeZone.UTC).toDate()), is("ನನ್ನ ಹುಟ್ಟು ಹಬ್ಬ 12/23/84"));
locale.setLocaleString(Localizer.LOCALE_ENGLISH_US);
assertThat(localizer.localize("MY_BIRTHDAY", new DateTime(1984, 12, 23, 14, 0, 0, 0, DateTimeZone.UTC).toDate()), is("My birthday is 12/23/84"));
}
示例5: messageSource
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean
ReloadableResourceBundleMessageSource messageSource() {
ReloadableResourceBundleMessageSource bundleMessageSource = new ReloadableResourceBundleMessageSource();
bundleMessageSource.setBasename("classpath:i18n/messages");
bundleMessageSource.setCacheSeconds(1800);
bundleMessageSource.setDefaultEncoding("UTF-8");
return bundleMessageSource;
}
示例6: emailMessageSource
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean
@Description("Spring mail message resolver")
public MessageSource emailMessageSource() {
log.info("loading non-reloadable mail messages resources");
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
messageSource.setBasename("classpath:/mails/messages/messages");
messageSource.setDefaultEncoding(CharEncoding.UTF_8);
return messageSource;
}
示例7: 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;
}
示例8: messageSource
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean
public MessageSource messageSource() { // Método para disponibilizar arquivos de mensagens
ReloadableResourceBundleMessageSource bundle
= new ReloadableResourceBundleMessageSource();
bundle.setBasename("/WEB-INF/messages/messages");
bundle.setDefaultEncoding("UTF-8");
bundle.setCacheSeconds(1);
return bundle;
}
示例9: DeviceDataURLs
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
public DeviceDataURLs(Device device, Locale locale) {
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
messageSource.setBasename("classpath:/messages/devices");
messageSource.setDefaultEncoding("UTF-8");
httpHostName = pubServerConfig.getHttpHostname();
httpPort = pubServerConfig.getHttpPort();
httpsPort = pubServerConfig.getHttpsPort();
mqttHostName = pubServerConfig.getMqttHostName();
mqttPort = pubServerConfig.getMqttPort();
mqttTlsPort = pubServerConfig.getMqttTlsPort();
context = pubServerConfig.getHttpCtx();
channel = messageSource.getMessage("model.device.channel", null, locale);
username = device.getApiKey();
if (httpHostName.equalsIgnoreCase("localhost")) {
this.httpHostName = "<ip>";
}
if (mqttHostName.equalsIgnoreCase("localhost")) {
mqttHostName = "<ip>";
}
if (StringUtils.hasText(device.getApplication().getDataApiDomain())) {
httpHostName = device.getApplication().getDataApiDomain();
}
if (StringUtils.hasText(device.getApplication().getDataMqttDomain())) {
mqttHostName = device.getApplication().getDataMqttDomain();
}
}
示例10: 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;
}
示例11: emailMessageSource
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean
@Description("Spring mail message resolver")
public MessageSource emailMessageSource() {
log.info("loading non-reloadable mail messages resources");
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
messageSource.setBasename("classpath:/mails/messages/messages");
messageSource.setDefaultEncoding(CharEncoding.UTF_8);
return messageSource;
}
示例12: messageSource
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean
public MessageSource messageSource() {
ReloadableResourceBundleMessageSource bundle = new ReloadableResourceBundleMessageSource();
bundle.setBasename("messages");
bundle.setDefaultEncoding(TEMPLATE_RESOLVER_CHAR_ENCODING);
bundle.setCacheSeconds(5);
return bundle;
}
示例13: getMessageSource
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean(name = "messageSource")
public ReloadableResourceBundleMessageSource getMessageSource() {
ReloadableResourceBundleMessageSource resource = new ReloadableResourceBundleMessageSource();
resource.setBasename("classpath:messages");
resource.setDefaultEncoding("UTF-8");
return resource;
}
示例14: messageSource
import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
/**
* This bean tells the application which message bundle to use.
*
* @return The message bundle source
*/
@Bean(name = "messageSource")
public ReloadableResourceBundleMessageSource messageSource()
{
ReloadableResourceBundleMessageSource messageBundle = new ReloadableResourceBundleMessageSource();
messageBundle.setFallbackToSystemLocale(false);
messageBundle.setBasename("classpath:messages/messages");
messageBundle.setDefaultEncoding("UTF-8");
return messageBundle;
}
示例15: 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;
}