This commit is contained in:
username 2024-09-18 10:37:44 +08:00
commit 0b13fc0432
1 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,24 @@
package com.hzya.frame.webapp.web.corsconfig;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @author 👻👻👻👻👻👻👻👻👻👻 gjh
* @version 1.0
* @content
* @date 2024-09-14 17:10
*/
@Configuration
public class CorsConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("GET", "POST", "PUT", "DELETE")
.allowedHeaders("*")
.allowCredentials(true);
}
}