可以用注解:在controller的方法上加@CrossOrgin()
这里用的是写一个@Configuration
package van.gateway.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration