Java Code Examples for org.springframework.context.support.ReloadableResourceBundleMessageSource#setDefaultEncoding()

The following examples show how to use org.springframework.context.support.ReloadableResourceBundleMessageSource#setDefaultEncoding() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebMvcConfig.java    From konker-platform with Apache License 2.0 7 votes vote down vote up
@Bean(name = "messageSource")
public MessageSource getMessageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.addBasenames("classpath:/messages/alert-triggers");
    messageSource.addBasenames("classpath:/messages/applications");
    messageSource.addBasenames("classpath:/messages/device-model");
    messageSource.addBasenames("classpath:/messages/devices");
    messageSource.addBasenames("classpath:/messages/devices-config");
    messageSource.addBasenames("classpath:/messages/gateways");
    messageSource.addBasenames("classpath:/messages/locations");
    messageSource.addBasenames("classpath:/messages/rest-destination");
    messageSource.addBasenames("classpath:/messages/routes");
    messageSource.addBasenames("classpath:/messages/routes-counter");
    messageSource.addBasenames("classpath:/messages/transformations");
    messageSource.addBasenames("classpath:/messages/users");
    messageSource.addBasenames("classpath:/messages/tenants");
    messageSource.addBasenames("classpath:/messages/health-alert");
    messageSource.addBasenames("classpath:/mail/MailMessages");
    messageSource.addBasenames("classpath:/messages/private-storage");
    messageSource.addBasenames("classpath:/messages/global");
    messageSource.setDefaultEncoding("UTF-8");

    return messageSource;
}
 
Example 2
Source File: MessageSouceTestConfiguration.java    From konker-platform with Apache License 2.0 6 votes vote down vote up
@Bean(name = "messageSource")
public MessageSource getMessageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.addBasenames("classpath:/messages/alert-triggers");
    messageSource.addBasenames("classpath:/messages/applications");
    messageSource.addBasenames("classpath:/messages/device-model");
    messageSource.addBasenames("classpath:/messages/devices");
    messageSource.addBasenames("classpath:/messages/devices-config");
    messageSource.addBasenames("classpath:/messages/gateways");
    messageSource.addBasenames("classpath:/messages/locations");
    messageSource.addBasenames("classpath:/messages/rest-destination");
    messageSource.addBasenames("classpath:/messages/routes");
    messageSource.addBasenames("classpath:/messages/transformations");
    messageSource.addBasenames("classpath:/messages/users");
    messageSource.addBasenames("classpath:/messages/tenants");
    messageSource.addBasenames("classpath:/messages/health-alert");
    messageSource.addBasenames("classpath:/mail/MailMessages");
    messageSource.setDefaultEncoding("UTF-8");

    return messageSource;
}
 
Example 3
Source File: ThymeleafConfiguration.java    From expper with GNU General Public License v3.0 5 votes vote down vote up
@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;
}
 
Example 4
Source File: SpringMessageSourceHelperTest.java    From trimou with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 5
Source File: ThymeleafConfiguration.java    From angularjs-springboot-bookstore with MIT License 5 votes vote down vote up
@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;
}
 
Example 6
Source File: AppConfiguration.java    From SMSC with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example 7
Source File: DeviceRegisterService.java    From konker-platform with Apache License 2.0 5 votes vote down vote up
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();
       }
}
 
Example 8
Source File: WebMvcConfig.java    From konker-platform with Apache License 2.0 5 votes vote down vote up
@Bean(name = "messageSource")
public MessageSource getMessageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.addBasenames(
            "classpath:/messages/devices",
            "classpath:/messages/routes",
            "classpath:/messages/routes-counter",
            "classpath:/messages/integration",
            "classpath:/messages/transformations",
            "classpath:/messages/devices-config",
            "classpath:/messages/applications");
    
    messageSource.setDefaultEncoding("UTF-8");
    return messageSource;
}
 
Example 9
Source File: WebMvcConfig.java    From konker-platform with Apache License 2.0 5 votes vote down vote up
@Bean(name = "messageSource")
public MessageSource getMessageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.addBasenames(
            "classpath:/messages/devices",
            "classpath:/messages/routes",
            "classpath:/messages/routes-counter",
            "classpath:/messages/integration",
            "classpath:/messages/transformations",
            "classpath:/messages/devices-config",
            "classpath:/messages/applications");
    
    messageSource.setDefaultEncoding("UTF-8");
    return messageSource;
}
 
Example 10
Source File: MessageSourceConfig.java    From konker-platform with Apache License 2.0 5 votes vote down vote up
@Bean(name = "messageSource")
public MessageSource getMessageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.addBasenames(
            "/WEB-INF/i18n/dateformats",
            "/WEB-INF/i18n/destinations",
            "/WEB-INF/i18n/devices",
            "/WEB-INF/i18n/email",
            "/WEB-INF/i18n/error",
            "/WEB-INF/i18n/global",
            "/WEB-INF/i18n/languages",
            "/WEB-INF/i18n/loglevels",
            "/WEB-INF/i18n/menu",
            "/WEB-INF/i18n/routes",
            "/WEB-INF/i18n/timezones",
            "/WEB-INF/i18n/tokens",
            "/WEB-INF/i18n/transformations",
            "/WEB-INF/i18n/usernotifications",
            "/WEB-INF/i18n/users",
            "/WEB-INF/i18n/visualization",
            "classpath:/messages/alert-triggers",
            "classpath:/messages/applications",
            "classpath:/messages/device-model",
            "classpath:/messages/devices",
            "classpath:/messages/rest-destination",
            "classpath:/messages/routes",
            "classpath:/messages/transformations",
            "classpath:/messages/rest-destination",
            "classpath:/messages/users",
            "classpath:/messages/tenants",
            "classpath:/messages/applications",
            "classpath:/messages/device-model",
            "classpath:/messages/health-alert",
            "classpath:/messages/routes-counter",
            "classpath:/messages/iugu",
            "classpath:/mail/MailMessages");
    messageSource.setDefaultEncoding("UTF-8");
    return messageSource;
}
 
Example 11
Source File: OauthServerApplication.java    From oauth-server with Apache License 2.0 5 votes vote down vote up
/**
 * messageBean配置文件
 *
 * @return Bean
 */
@Bean(name = "messageSource")
public ReloadableResourceBundleMessageSource messageSource() {
    ReloadableResourceBundleMessageSource messageBundle =
            new ReloadableResourceBundleMessageSource();
    messageBundle.setBasename("classpath:messages/messages");
    messageBundle.setDefaultEncoding("UTF-8");
    return messageBundle;
}
 
Example 12
Source File: WebMvcConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@Bean
public ReloadableResourceBundleMessageSource messageSource() {
    ReloadableResourceBundleMessageSource resource = new ReloadableResourceBundleMessageSource();
    resource.setBasenames("/WEB-INF/locales/messages");
    resource.setDefaultEncoding("UTF-8");
    resource.setFallbackToSystemLocale(Boolean.TRUE);
    return resource;
}
 
Example 13
Source File: WebMvcConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@Bean
public ReloadableResourceBundleMessageSource messageSource() {
    ReloadableResourceBundleMessageSource resource = new ReloadableResourceBundleMessageSource();
    resource.setBasenames("/WEB-INF/locales/messages");
    resource.setDefaultEncoding("UTF-8");
    resource.setFallbackToSystemLocale(Boolean.TRUE);
    return resource;
}
 
Example 14
Source File: WebMvcConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@Bean
public ReloadableResourceBundleMessageSource messageSource() {
    ReloadableResourceBundleMessageSource resource = new ReloadableResourceBundleMessageSource();
    resource.setBasenames("/WEB-INF/locales/messages");
    resource.setDefaultEncoding("UTF-8");
    resource.setFallbackToSystemLocale(Boolean.TRUE);
    return resource;
}
 
Example 15
Source File: WebMvcConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@Bean
public ReloadableResourceBundleMessageSource messageSource() {
    ReloadableResourceBundleMessageSource resource = new ReloadableResourceBundleMessageSource();
    resource.setBasenames("/WEB-INF/locales/messages");
    resource.setDefaultEncoding("UTF-8");
    resource.setFallbackToSystemLocale(Boolean.TRUE);
    return resource;
}
 
Example 16
Source File: WebMvcConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@Bean
public ReloadableResourceBundleMessageSource messageSource() {
    ReloadableResourceBundleMessageSource resource = new ReloadableResourceBundleMessageSource();
    resource.setBasenames("/WEB-INF/locales/messages");
    resource.setDefaultEncoding("UTF-8");
    resource.setFallbackToSystemLocale(Boolean.TRUE);
    return resource;
}
 
Example 17
Source File: RestHandlerExceptionResolverBuilder.java    From spring-rest-exception-handler with Apache License 2.0 5 votes vote down vote up
private MessageSource createDefaultMessageSource() {

        ReloadableResourceBundleMessageSource messages = new ReloadableResourceBundleMessageSource();
        messages.setBasename(DEFAULT_MESSAGES_BASENAME);
        messages.setDefaultEncoding("UTF-8");
        messages.setFallbackToSystemLocale(false);

        return messages;
    }
 
Example 18
Source File: WebMvcConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@Bean
public ReloadableResourceBundleMessageSource messageSource() {
    ReloadableResourceBundleMessageSource resource = new ReloadableResourceBundleMessageSource();
    resource.setBasenames("/WEB-INF/locales/messages");
    resource.setDefaultEncoding("UTF-8");
    resource.setFallbackToSystemLocale(Boolean.TRUE);
    return resource;
}
 
Example 19
Source File: HibernateValidateConfig.java    From spring-boot-api-project-seed with Apache License 2.0 5 votes vote down vote up
@Bean
public ReloadableResourceBundleMessageSource messageSource() {
    ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource = new ReloadableResourceBundleMessageSource();
    reloadableResourceBundleMessageSource.setBasenames("classpath:message/ValidationMessages");
    reloadableResourceBundleMessageSource.setUseCodeAsDefaultMessage(true);
    reloadableResourceBundleMessageSource.setDefaultEncoding("UTF-8");
    reloadableResourceBundleMessageSource.setCacheSeconds(60);
    return reloadableResourceBundleMessageSource;
}
 
Example 20
Source File: MessageSourceInterpolator.java    From cm_ext with Apache License 2.0 4 votes vote down vote up
private MessageSource messageSource() {
  ReloadableResourceBundleMessageSource bean = new ReloadableResourceBundleMessageSource();
  bean.setBasename("classpath:schema.validation");
  bean.setDefaultEncoding("UTF-8");
  return bean;
}