package com.fufan.mtsaas.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * springMvc 配置
 *
 * @version 1.0
 * @auther Liby
 * @create 2018/5/16
 **/
//@Configuration
public class WebMvcConfigurer extends WebMvcConfigurationSupport {

    @Override
    protected void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins("*")
                .allowedMethods("GET", "POST", "PUT", "OPTIONS", "DELETE", "PATCH")
                .allowedHeaders("Origin, X-Requested-With, Content-Type, Accept")
                .allowCredentials(true).maxAge(3600);
    }
}
