@Configuration
public class CorsConfig extends WebMvcConfigurerAdapter {
/**
* 页面跨域访问Controller过滤
*
* @return
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE")
.maxAge(3600)
.allowCredentials(true);
}
}
server:
port: 8980
context-path: /XXX