10-1跨域
文章目录
from origin 'http://localhost:8080' has been blocked by CORS policy
`package com.demo.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
- Author:js
- Date:2019/
*/
@Configuration
@EnableWebMvc
public class CorsConfig extends WebMvcConfigurerAdapter {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**");
}}`
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论