我使用的前端不变,后端改变的添加配置的方法,但是就是@Override重写,请问该如何解决呢?
package com.ywyl.sh.platform.config;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
/**
* 解决vue+springboot跨域问题
* @Author Stephen
* @Time 2021/08/10
*/
@Configuration
@EnableWebMvc
public class Cor {
@Override
public void addCorsMappings(CorsRegistry registry){
registry.addMapping("/**")
.allowedOrigins("*")//此处为前端地址,注意不能为*
.allowedMethods("GET","POST","PUT","OPTIONS","DELETE","PATCH")
.allowCredentials(true).maxAge(3600);
}
}