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

The following examples show how to use org.springframework.context.support.ReloadableResourceBundleMessageSource#setBasename() . 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: 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 2
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 3
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 4
Source File: MvcAutoConfiguration.java    From MaxKey with Apache License 2.0 5 votes vote down vote up
/**
 * 消息处理,可以直接使用properties的key值,返回的是对应的value值
 * messageSource .
 * @return messageSource
 */
@Bean (name = "messageSource")
public ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource(
        @Value("${spring.messages.basename:classpath:messages/message}")
        String messagesBasename)  {
    _logger.debug("Basename " + messagesBasename);
    
    ReloadableResourceBundleMessageSource messageSource = 
            new ReloadableResourceBundleMessageSource();
    messageSource.setBasename(messagesBasename);
    messageSource.setUseCodeAsDefaultMessage(false);
    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: ThymeleafConfiguration.java    From ServiceCutter with Apache License 2.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 7
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 8
Source File: InternationalizationConfig.java    From Spring with Apache License 2.0 5 votes vote down vote up
@Bean
public MessageSource bundleMessageSource() {
    final ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("messages");
    return messageSource;
}
 
Example 9
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 10
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;
}
 
Example 11
Source File: ApplicationRecoverableExceptionTest.java    From sinavi-jfw with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setup() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("classpath:/jp/co/ctc_g/jfw/core/exception/error");
    MessageSourceLocator.set(messageSource);
}
 
Example 12
Source File: ApplicationExceptionTest.java    From sinavi-jfw with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setup() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("classpath:/jp/co/ctc_g/jfw/core/exception/error");
    MessageSourceLocator.set(messageSource);
}
 
Example 13
Source File: SystemExceptionTest.java    From sinavi-jfw with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setup() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("classpath:/jp/co/ctc_g/jfw/core/exception/error");
    MessageSourceLocator.set(messageSource);
}
 
Example 14
Source File: ApplicationUnrecoverableExceptionTest.java    From sinavi-jfw with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setup() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("classpath:/jp/co/ctc_g/jfw/core/exception/error");
    MessageSourceLocator.set(messageSource);
}
 
Example 15
Source File: MessagesTest.java    From sinavi-jfw with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("classpath:/jp/co/ctc_g/jse/core/message/MessageContextTest");
    MessageSourceLocator.set(messageSource);
}
 
Example 16
Source File: JseMessagesTagTest.java    From sinavi-jfw with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setupClass() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("classpath:/jp/co/ctc_g/jse/core/message/JseMessagesTagTest");
    MessageSourceLocator.set(messageSource);
}
 
Example 17
Source File: JseErrorsTagTest.java    From sinavi-jfw with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setupClass() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("classpath:/jp/co/ctc_g/jse/core/message/JseMessagesTagTest");
    MessageSourceLocator.set(messageSource);
}
 
Example 18
Source File: JseValidationsTagTest.java    From sinavi-jfw with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setupClass() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("classpath:/jp/co/ctc_g/jse/core/message/JseMessagesTagTest");
    MessageSourceLocator.set(messageSource);
}
 
Example 19
Source File: MessageContextTest.java    From sinavi-jfw with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("classpath:/jp/co/ctc_g/jse/core/message/MessageContextTest");
    MessageSourceLocator.set(messageSource);
}
 
Example 20
Source File: JseInformationsTagTest.java    From sinavi-jfw with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setupClass() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("classpath:/jp/co/ctc_g/jse/core/message/JseMessagesTagTest");
    MessageSourceLocator.set(messageSource);
}