You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
798 B
28 lines
798 B
package com.cyjd.rights.config;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
/**
|
|
* MVC配置
|
|
*
|
|
* @author yz
|
|
*/
|
|
@Configuration
|
|
public class WebMvcConfig implements WebMvcConfigurer {
|
|
|
|
|
|
@Override
|
|
public void addCorsMappings(CorsRegistry registry) {
|
|
registry.addMapping("/**")
|
|
.allowedOriginPatterns("*") // 允许所有来源
|
|
.allowCredentials(true)
|
|
.allowedMethods("GET", "POST", "PUT", "DELETE")
|
|
.allowedHeaders("*")
|
|
.exposedHeaders("Header-1");
|
|
}
|
|
|
|
|
|
}
|
|
|