|
@@ -3,7 +3,9 @@ package com.example.demo;
|
3
|
3
|
import org.springframework.boot.SpringApplication;
|
4
|
4
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
5
|
5
|
import org.springframework.context.annotation.Bean;
|
|
6
|
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
6
|
7
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
8
|
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
7
|
9
|
|
8
|
10
|
@SpringBootApplication
|
9
|
11
|
public class DemoApplication {
|
|
@@ -11,4 +13,14 @@ public class DemoApplication {
|
11
|
13
|
public static void main(String[] args) {
|
12
|
14
|
SpringApplication.run(DemoApplication.class, args);
|
13
|
15
|
}
|
|
16
|
+
|
|
17
|
+ @Bean
|
|
18
|
+ public WebMvcConfigurer corsConfigurer() {
|
|
19
|
+ return new WebMvcConfigurerAdapter() {
|
|
20
|
+ @Override
|
|
21
|
+ public void addCorsMappings(CorsRegistry registry) {
|
|
22
|
+ registry.addMapping("*").allowedOrigins("http://localhost:9000");
|
|
23
|
+ }
|
|
24
|
+ };
|
|
25
|
+ }
|
14
|
26
|
}
|