Skip to content

Commit

Permalink
完成跨域访问配置
Browse files Browse the repository at this point in the history
  • Loading branch information
suvvm committed Nov 13, 2019
1 parent f2fab65 commit 352ae7a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package qdu.suvvm.onlinesurvey.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


/**
* @Author: SUVVM
* @Date: 2019/11/13 19:21
*/
@Configuration
public class CorsConfig implements WebMvcConfigurer {
/**
* 页面跨域访问Controller过滤
*
* @return
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
WebMvcConfigurer.super.addCorsMappings(registry);
registry.addMapping("/**")
.allowedHeaders("*")
.allowedMethods("POST","GET")
.allowedOrigins("*");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package qdu.suvvm.onlinesurvey.controller;

/**
* @Author: SUVVM
* @Date: 2019/11/13 19:17
*/
public class SmsController {
}

0 comments on commit 352ae7a

Please sign in to comment.