Code example for WebMvcConfigurationSupport

0
 */ 
@Configuration 
@EnableWebMvc 
@PropertySource("classpath:resources.properties") 
@ComponentScan(basePackages = "com.sishuok.spring4") 
public class MvcConfiguration extends WebMvcConfigurationSupport { 
 
    @Autowired 
    private Environment env; 
 
    @Override 
    protected Validator getValidator() { 
        LocalValidatorFactoryBean localValidatorFactoryBean = 
                new LocalValidatorFactoryBean(); 
        localValidatorFactoryBean.setProviderClass(HibernateValidator.class); 
        localValidatorFactoryBean.setValidationMessageSource(messageSource()); 
        return localValidatorFactoryBean; 
    } 
 
    @Override