mirror of
https://github.com/201206030/novel-cloud.git
synced 2025-06-24 14:06:39 +00:00
上传通用模块/代码生成模块/网关基础服务/监控基础服务/用户微服务
This commit is contained in:
@ -0,0 +1,18 @@
|
||||
package com.java2nb.novel.gateway;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 网关启动类
|
||||
* @author xiongxiaoyang
|
||||
* @version 1.0
|
||||
* @since 2020/5/27
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class GatewayApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(GatewayApplication.class);
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.java2nb.novel.gateway.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;
|
||||
|
||||
/**
|
||||
* 全局跨域配置
|
||||
* @author xiongxiaoyang
|
||||
* @version 1.0
|
||||
* @since 2020/5/27
|
||||
*/
|
||||
@Configuration
|
||||
public class NovelCorsConfig {
|
||||
|
||||
@Bean
|
||||
public CorsWebFilter corsWebFilter() {
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
// 允许的域,不要写*,否则cookie就无法使用了
|
||||
config.addAllowedOrigin("http://localhost:8080");
|
||||
// 允许的头信息
|
||||
config.addAllowedHeader("*");
|
||||
// 允许的请求方式
|
||||
config.addAllowedMethod("*");
|
||||
// 是否允许携带Cookie信息
|
||||
config.setAllowCredentials(true);
|
||||
|
||||
UrlBasedCorsConfigurationSource configurationSource = new UrlBasedCorsConfigurationSource();
|
||||
// 添加映射路径,拦截一切请求
|
||||
configurationSource.registerCorsConfiguration("/**",config);
|
||||
return new CorsWebFilter(configurationSource);
|
||||
}
|
||||
}
|
10
novel-gateway/src/main/resources/bootstrap.yml
Normal file
10
novel-gateway/src/main/resources/bootstrap.yml
Normal file
@ -0,0 +1,10 @@
|
||||
spring:
|
||||
application:
|
||||
name: novel-gateway
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
server-addr: 47.106.243.172:8848
|
||||
file-extension: yml
|
||||
group: dev
|
||||
namespace: 99be05ee-edf9-4fd3-99b8-9cc68d11f049
|
Reference in New Issue
Block a user