修正项目
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package com.yovinchen.xlcs;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
|
||||
/**
|
||||
* ClassName: ServiceGatewayApplication
|
||||
* Package: com.yovinchen.xlcs
|
||||
*
|
||||
* @author yovinchen
|
||||
* @Create 2023/9/20 16:51
|
||||
*/
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
public class ServiceGatewayApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ServiceGatewayApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package com.yovinchen.xlcs.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.reactive.CorsWebFilter;
|
||||
import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.util.pattern.PathPatternParser;
|
||||
|
||||
/**
|
||||
* ClassName: CorsConfig
|
||||
* Package: com.yovinchen.xlcs.config.config
|
||||
*
|
||||
* @author yovinchen
|
||||
* @Create 2023/9/20 16:52
|
||||
*/
|
||||
@Configuration
|
||||
public class CorsConfig {
|
||||
|
||||
@Bean
|
||||
public CorsWebFilter corsFilter() {
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
config.addAllowedMethod("*");
|
||||
config.addAllowedOrigin("*");
|
||||
config.addAllowedHeader("*");
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(new PathPatternParser());
|
||||
source.registerCorsConfiguration("/**", config);
|
||||
return new CorsWebFilter(source);
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
server:
|
||||
port: 8200
|
||||
spring:
|
||||
application:
|
||||
name: service-gateway
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 82.157.68.223:8848
|
||||
username: nacos
|
||||
password: nacos
|
11
xlcs-parent/service-gateway/src/main/resources/bootstrap.yml
Normal file
11
xlcs-parent/service-gateway/src/main/resources/bootstrap.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
namespace: dd5265c5-8290-45bc-9d07-395c14c977d3
|
||||
server-addr: 82.157.68.223:8848
|
||||
group: service
|
||||
username: nacos
|
||||
password: nacos
|
||||
enabled: true
|
||||
file-extension: yml
|
Reference in New Issue
Block a user