Spring Framework ResourceBundleMessageSource - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework ResourceBundleMessageSource class.

This code example shows how to use the following methods:setBasename, setUseCodeAsDefaultMessage
 
    private static final String MESSAGE_SOURCE_BASE_NAME = "i18n/messages";
 
    @Bean 
    public MessageSource messageSource() {
        ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
 
        messageSource.setBasename(MESSAGE_SOURCE_BASE_NAME);
        messageSource.setUseCodeAsDefaultMessage(true);
 
        return messageSource;
    } 
 
    @Bean 
    public TodoService todoService() { 
        return Mockito.mock(TodoService.class); 
    } 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setBasename
 * @author Ben Alex 
 */ 
public class SpringSecurityMessageSource extends ResourceBundleMessageSource {
    //~ Constructors =================================================================================================== 
 
    public SpringSecurityMessageSource() { 
        setBasename("org.springframework.security.messages");
    } 
 
    //~ Methods ======================================================================================================== 
 
    public static MessageSourceAccessor getAccessor() {
        return new MessageSourceAccessor(new SpringSecurityMessageSource());
    } 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setBasename
This code example shows how to use the following methods:setBasename, setUseCodeAsDefaultMessage
 
import javax.annotation.Resource; 
import java.util.List;
 
/** 
 * @author Petri Kainulainen 
 */ 
@Configuration 
@EnableWebMvc 
@ComponentScan(basePackages = {"net.petrikainulainen.spring.testmvc.controller"}) 
public class ExampleApplicationContext extends WebMvcConfigurerAdapter {
 
    private static final String MESSAGE_SOURCE_BASE_NAME = "i18n/messages";
 
    private static final String VIEW_RESOLVER_PREFIX = "/WEB-INF/jsp/";
    private static final String VIEW_RESOLVER_SUFFIX = ".jsp";
 
    @Override 
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/**").addResourceLocations("/static/");
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setBasename
@EnableTransactionManagement 
public class JpaRepositoryConfig { 
 
	@Bean 
	public MessageSource messageSource() { 
		ResourceBundleMessageSource ms = new ResourceBundleMessageSource(); 
		ms.setBasename("org.springframework.data.rest.core.ValidationErrors"); 
		return ms; 
	} 
 
	@Bean 
	public DataSource dataSource() { 
		EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder(); 
		return builder.setType(EmbeddedDatabaseType.HSQL).build(); 
	} 
 
	@Bean 
	public EntityManagerFactory entityManagerFactory() { 
		HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); 
		vendorAdapter.setDatabase(Database.HSQL); 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setBasename
	/** 
	 * @see org.springframework.ui.context.ThemeSource#getTheme(java.lang.String) 
	 */ 
	@Override 
	public Theme getTheme(String ignoredArgument) {
		ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
		messageSource.setBasename(this.themeName);
		return new SimpleTheme(themeName, messageSource);
	} 
	 
	/** 
	 * @param themeName the themeName to set 
	 */ 
	public void setThemeName(String themeName) {
		this.themeName = themeName;
	} 
	 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setBasenames, setUseCodeAsDefaultMessage
	 * implementations use a {@link java.util.ResourceBundle} to parse the property files with the messages in it. 
	 * @return the {@link MessageSource} 
	 */ 
	@Bean 
	public MessageSource messageSource() {
		ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
		messageSource.setBasenames(new String[] { "messages", "org.springframework.security.messages" });
		messageSource.setUseCodeAsDefaultMessage(true);
		return messageSource;
	} 
 
	// -- End Locale Support (I18N) --// 
 
	@Bean 
	public ViewResolver tilesViewResolver() {
		UrlBasedViewResolver urlBasedViewResolver = new AjaxUrlBasedViewResolver();
		urlBasedViewResolver.setOrder(1);
		urlBasedViewResolver.setViewClass(FlowAjaxTilesView.class);
		return urlBasedViewResolver;
	} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setBasename, setDefaultEncoding
 */ 
@org.springframework.context.annotation.Configuration 
public class Configuration { 
    @Bean 
    public MessageSource messageSource() { 
        ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); 
        messageSource.setBasename("messages"); 
        messageSource.setDefaultEncoding("UTF-8"); 
        return messageSource; 
    } 
     
    @Bean 
    public Validator validator() { 
        LocalValidatorFactoryBean factoryBean = new LocalValidatorFactoryBean(); 
        factoryBean.setValidationMessageSource(messageSource()); 
        return factoryBean; 
    } 
     
    @Bean 
    public MultipartResolver getMultipartResolver() { 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setBasename, setUseCodeAsDefaultMessage
 
    private static final String MESSAGE_SOURCE_BASE_NAME = "i18n/messages";
 
    @Bean 
    public MessageSource messageSource() {
        ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
 
        messageSource.setBasename(MESSAGE_SOURCE_BASE_NAME);
        messageSource.setUseCodeAsDefaultMessage(true);
 
        return messageSource;
    } 
 
    @Bean 
    public UserService userService() { 
        return mock(UserService.class); 
    } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setBasename, setUseCodeAsDefaultMessage
See Code Examples for Spring Framework ResourceBundleMessageSource Methods: