File tree Expand file tree Collapse file tree 3 files changed +32
-27
lines changed
src/main/java/com/boylegu/springboot_vue Expand file tree Collapse file tree 3 files changed +32
-27
lines changed Original file line number Diff line number Diff line change 33import org .springframework .boot .SpringApplication ;
44import org .springframework .boot .autoconfigure .SpringBootApplication ;
55
6+
67@ SpringBootApplication
78public class App {
89
Original file line number Diff line number Diff line change 1+ package com .boylegu .springboot_vue .config ;
2+
3+ import org .springframework .context .annotation .Bean ;
4+ import org .springframework .context .annotation .Configuration ;
5+ import org .springframework .web .servlet .config .annotation .CorsRegistry ;
6+ import org .springframework .web .servlet .config .annotation .WebMvcConfigurer ;
7+ import org .springframework .web .servlet .config .annotation .WebMvcConfigurerAdapter ;
8+
9+ import static org .springframework .web .cors .CorsConfiguration .ALL ;
10+
11+ /**
12+ * CORS configuration
13+ */
14+ @ Configuration
15+ public class CORSConfig {
16+
17+ @ Bean
18+ public WebMvcConfigurer corsConfigurer () {
19+ return new WebMvcConfigurerAdapter () {
20+ @ Override
21+ public void addCorsMappings (CorsRegistry registry ) {
22+ registry .addMapping ("/**" )
23+ .allowedOrigins (ALL )
24+ .allowedMethods (ALL )
25+ .allowedHeaders (ALL )
26+ .allowCredentials (true );
27+ }
28+ };
29+ }
30+
31+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments