|
@@ -4,13 +4,33 @@ import org.springframework.boot.SpringApplication;
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
|
|
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
|
|
import org.springframework.cloud.netflix.feign.EnableFeignClients;
|
|
import org.springframework.cloud.netflix.feign.EnableFeignClients;
|
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
|
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
|
|
|
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
|
|
|
|
|
@SpringBootApplication
|
|
@SpringBootApplication
|
|
@EnableEurekaClient
|
|
@EnableEurekaClient
|
|
@EnableFeignClients
|
|
@EnableFeignClients
|
|
public class Application {
|
|
public class Application {
|
|
|
|
|
|
- public static void main(String[] args) throws Exception {
|
|
|
|
- SpringApplication.run(Application.class, args);
|
|
|
|
- }
|
|
|
|
|
|
+ public static void main(String[] args) throws Exception {
|
|
|
|
+ SpringApplication.run(Application.class, args);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Bean
|
|
|
|
+ public WebMvcConfigurer corsConfigurer() {
|
|
|
|
+ return new WebMvcConfigurerAdapter() {
|
|
|
|
+ public void addCorsMappings(CorsRegistry registry) {
|
|
|
|
+ registry.addMapping("/**");
|
|
|
|
+
|
|
|
|
+// registry.addMapping("/**")
|
|
|
|
+// .allowedOrigins("*")
|
|
|
|
+// .allowedMethods("GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "TRACE")
|
|
|
|
+// .allowedHeaders("*")
|
|
|
|
+// .exposedHeaders("access_token", "credentials", "refresh_token")
|
|
|
|
+// .allowCredentials(true).maxAge(3600);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ }
|
|
}
|
|
}
|