From c3b722bde72b6d74c16d9c099074431e2a43c584 Mon Sep 17 00:00:00 2001 From: Katerina881 Date: Tue, 7 Feb 2023 11:25:18 +0400 Subject: [PATCH] CORS --- .../java/com/example/springip/WebConfiguration.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/main/java/com/example/springip/WebConfiguration.java diff --git a/src/main/java/com/example/springip/WebConfiguration.java b/src/main/java/com/example/springip/WebConfiguration.java new file mode 100644 index 0000000..e0b7b0f --- /dev/null +++ b/src/main/java/com/example/springip/WebConfiguration.java @@ -0,0 +1,12 @@ +package com.example.springip; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class WebConfiguration implements WebMvcConfigurer { + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**").allowedMethods("*"); + } +} \ No newline at end of file