From 169c8b2d34e80324ac580cb5246bcb192c0dafb5 Mon Sep 17 00:00:00 2001 From: ghdeo Date: Fri, 20 Oct 2023 01:56:01 +0900 Subject: [PATCH] =?UTF-8?q?[FEAT]=20WebMvcConfig=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kkanbustock/config/WebMvcConfig.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/main/java/com/bull4jo/kkanbustock/config/WebMvcConfig.java diff --git a/src/main/java/com/bull4jo/kkanbustock/config/WebMvcConfig.java b/src/main/java/com/bull4jo/kkanbustock/config/WebMvcConfig.java new file mode 100644 index 0000000..d104fe8 --- /dev/null +++ b/src/main/java/com/bull4jo/kkanbustock/config/WebMvcConfig.java @@ -0,0 +1,27 @@ +package com.bull4jo.kkanbustock.config; + + +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.CorsConfigurationSource; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CommonsRequestLoggingFilter; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import javax.servlet.Filter; + +@Configuration +public class WebMvcConfig implements WebMvcConfigurer { + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("http://localhost:3000") + .allowedMethods("*") // 기타 설정 + .allowedHeaders("*"); + } +} \ No newline at end of file