From 91591ae894123aec875b8651a03a7ade72c71b73 Mon Sep 17 00:00:00 2001 From: Arklightning Date: Mon, 13 Feb 2023 16:08:44 +0400 Subject: [PATCH] =?UTF-8?q?Commit=202=20=D0=9A=D0=BE=D0=BD=D1=84=D0=B8?= =?UTF-8?q?=D0=B3=D1=83=D1=80=D0=B0=D1=86=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/example/demo/DemoApplication.java | 2 ++ .../java/com/example/demo/WebConfiguration.java | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 src/main/java/com/example/demo/WebConfiguration.java diff --git a/src/main/java/com/example/demo/DemoApplication.java b/src/main/java/com/example/demo/DemoApplication.java index 89506cd..4396cee 100644 --- a/src/main/java/com/example/demo/DemoApplication.java +++ b/src/main/java/com/example/demo/DemoApplication.java @@ -16,4 +16,6 @@ public class DemoApplication { public String hello(@RequestParam(value = "name", defaultValue = "World") String name) { return String.format("Hello %s!", name); } + + } diff --git a/src/main/java/com/example/demo/WebConfiguration.java b/src/main/java/com/example/demo/WebConfiguration.java new file mode 100644 index 0000000..6d1cb02 --- /dev/null +++ b/src/main/java/com/example/demo/WebConfiguration.java @@ -0,0 +1,13 @@ +package com.example.demo; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +class webConfiguration implements WebMvcConfigurer { + @Override + public void addCorsMappings(CorsRegistry registry){ + registry.addMapping("/**").allowedMethods("*"); + } +}