All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.adorsys.opba.protocol.xs2a.config.I18NConfig Maven / Gradle / Ivy

package de.adorsys.opba.protocol.xs2a.config;

import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;

/**
 * Internationalization configuration for the messages.
 */
// TODO: We need to decide if we want to have i18n on backend side. Probably, we don't.
@Configuration
public class I18NConfig {

    @Bean
    public MessageSource messageSource() {
        ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
        messageSource.setBasename("classpath:messages");
        messageSource.setDefaultEncoding("UTF-8");
        return messageSource;
    }

    @Bean
    public LocalValidatorFactoryBean getValidator() {
        LocalValidatorFactoryBean bean = new LocalValidatorFactoryBean();
        bean.setValidationMessageSource(messageSource());
        return bean;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy