Skip to content

Commit beef0df

Browse files
committed
๐Ÿ”ง Fix: ์ฝ”๋“œ ์Šคํƒ€์ผ ์ •๋ฆฌ (Spotless ์ ์šฉ)
1 parent dad1d22 commit beef0df

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

โ€Žsrc/main/java/com/going/server/global/config/SwaggerConfig.javaโ€Ž

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import io.swagger.v3.oas.models.servers.Server;
66
import org.springframework.context.annotation.Bean;
77
import org.springframework.context.annotation.Configuration;
8+
import org.springframework.web.servlet.config.annotation.CorsRegistry;
9+
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
810

911
@Configuration
1012
public class SwaggerConfig {
@@ -18,4 +20,17 @@ public OpenAPI OpenAPI() {
1820
return new OpenAPI()
1921
.info(info);
2022
}
23+
@Bean
24+
public WebMvcConfigurer corsConfigurer() {
25+
return new WebMvcConfigurer() {
26+
@Override
27+
public void addCorsMappings(CorsRegistry registry) {
28+
registry.addMapping("/**")
29+
.allowedOrigins("*")
30+
.allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS")
31+
.allowedHeaders("*")
32+
.allowCredentials(true);
33+
}
34+
};
35+
}
2136
}

0 commit comments

Comments
ย (0)