支持ajax跨域

This commit is contained in:
mxd 2019-11-11 11:37:25 +08:00
parent 9e640ee7a8
commit 7bba985ce2
3 changed files with 823 additions and 792 deletions

View File

@ -1,19 +1,28 @@
package org.spiderflow.configuration;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* 配置放行静态资源文件
* @author Administrator
*
*/
@Configuration
public class ResourcesConfiguration implements WebMvcConfigurer{
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
}
}
package org.spiderflow.configuration;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* 配置放行静态资源文件
* @author Administrator
*
*/
@Configuration
public class ResourcesConfiguration implements WebMvcConfigurer{
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
}
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("GET","POST","OPTIONS")
.allowCredentials(true);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long