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