package com.jeequan.jeepay.pay.config;

import com.jeequan.jeepay.core.config.WebConfig;
import org.springframework.boot.validation.MessageInterpolatorFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Role;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;

/*
* webmvc配置
*
* @author terrfly
*
* @date 2021/6/8 17:12
*/
@Configuration
public class WebmvcConfig extends WebConfig {

    @Bean
    @Role(2)
    public static LocalValidatorFactoryBean defaultValidator() {
        LocalValidatorFactoryBean factoryBean = new LocalValidatorFactoryBean();
        MessageInterpolatorFactory interpolatorFactory = new MessageInterpolatorFactory();
        factoryBean.setMessageInterpolator(interpolatorFactory.getObject());
        return factoryBean;
    }
}
