Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
spring-timeloit-update
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
loit-Infrastructure-example
spring-timeloit-update
Commits
c54aa873
提交
c54aa873
authored
8月 31, 2020
作者:
陈世营
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
spring-gateway init
上级
d7673dfb
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
581 行增加
和
0 行删除
+581
-0
.gitignore
.gitignore
+34
-0
README.MD
README.MD
+0
-0
pom.xml
loit-gateway/pom.xml
+151
-0
GateWayApplication.java
...way/src/main/java/com/loit/getway/GateWayApplication.java
+31
-0
application-dev.yml
loit-gateway/src/main/resources/application-dev.yml
+193
-0
application.yml
loit-gateway/src/main/resources/application.yml
+3
-0
bootstrap.properties
loit-gateway/src/main/resources/bootstrap.properties
+6
-0
pom.xml
pom.xml
+163
-0
没有找到文件。
.gitignore
0 → 100644
浏览文件 @
c54aa873
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
logs/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
.idea/*
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/
README.MD
0 → 100644
浏览文件 @
c54aa873
loit-gateway/pom.xml
0 → 100644
浏览文件 @
c54aa873
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
demo
</artifactId>
<groupId>
com.loit
</groupId>
<version>
0.0.1-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
loit-gateway
</artifactId>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<java.version>
1.8
</java.version>
<springfox-swagger-ui.version>
2.9.2
</springfox-swagger-ui.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-gateway
</artifactId>
</dependency>
<!-- nacos 配置中心 -->
<dependency>
<groupId>
com.timeloit.cloud
</groupId>
<artifactId>
spring-cloud-starter-timeloit-nacos-config
</artifactId>
</dependency>
<!-- nacos 注册中心 -->
<dependency>
<groupId>
com.timeloit.cloud
</groupId>
<artifactId>
spring-cloud-starter-timeloit-nacos-discovery
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
</dependency>
<!-- sentinel gateway流控 -->
<dependency>
<groupId>
com.timeloit.cloud
</groupId>
<artifactId>
spring-cloud-starter-timeloit-sentinel
</artifactId>
</dependency>
<dependency>
<groupId>
com.timeloit.cloud
</groupId>
<artifactId>
spring-cloud-timeloit-sentinel-gateway
</artifactId>
</dependency>
<!-- sentinel nacos 整合 -->
<dependency>
<groupId>
com.timeloit.cloud
</groupId>
<artifactId>
spring-cloud-timeloit-sentinel-datasource
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba.csp
</groupId>
<artifactId>
sentinel-datasource-nacos
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-hystrix
</artifactId>
<exclusions>
<exclusion>
<groupId>
commons-logging
</groupId>
<artifactId>
commons-logging
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
de.codecentric
</groupId>
<artifactId>
spring-boot-admin-starter-client
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<!--网关集成swagger SpringBoot swagger2 -->
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
<version>
${springfox-swagger-ui.version}
</version>
</dependency>
<!-- 网关集成swagger SpringBoot swagger2 -UI -->
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
<version>
${springfox-swagger-ui.version}
</version>
</dependency>
<dependency>
<groupId>
com.loit
</groupId>
<artifactId>
loit-portal-api
</artifactId>
<version>
1.0.3
</version>
</dependency>
<!-- 微服务:Feign -->
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-openfeign
</artifactId>
</dependency>
</dependencies>
<build>
<finalName>
loit-getway
</finalName>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
<!-- 配置java版本 不配置的话默认父类配置的是1.6-->
<pluginManagement>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<configuration>
<mainClass>
com.loit.getway.GateWayApplication
</mainClass>
</configuration>
</plugin>
<plugin>
<artifactId>
maven-compiler-plugin
</artifactId>
<configuration>
<source>
1.8
</source>
<target>
1.8
</target>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-war-plugin
</artifactId>
<version>
2.6
</version>
<configuration>
<failOnMissingWebXml>
false
</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
\ No newline at end of file
loit-gateway/src/main/java/com/loit/getway/GateWayApplication.java
0 → 100644
浏览文件 @
c54aa873
package
com
.
loit
.
getway
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.cloud.client.SpringCloudApplication
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.cloud.netflix.hystrix.EnableHystrix
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
/**
* 项目启动
*
* @author wbh
*/
@EnableHystrix
@EnableScheduling
@SpringCloudApplication
@EnableDiscoveryClient
@EnableFeignClients
public
class
GateWayApplication
{
public
static
void
main
(
String
[]
args
)
{
long
startTime
=
System
.
currentTimeMillis
();
SpringApplication
.
run
(
GateWayApplication
.
class
,
args
);
long
endTime
=
System
.
currentTimeMillis
();
float
excTime
=(
float
)(
endTime
-
startTime
)/
1000
;
System
.
out
.
println
(
"############--- loit-getway项目启动成功,执行用时:"
+
excTime
+
"秒 ---############"
);
}
}
\ No newline at end of file
loit-gateway/src/main/resources/application-dev.yml
0 → 100644
浏览文件 @
c54aa873
server
:
port
:
7001
#权限配置
management
:
endpoints
:
web
:
exposure
:
include
:
"
*"
endpoint
:
health
:
show-details
:
ALWAYS
info
:
name
:
'
@project.name@'
description
:
'
@project.description@'
spring
:
application
:
name
:
loit-getway
cloud
:
nacos
:
discovery
:
# Nacos 注册中心地址
server-addr
:
47.114.50.99:8010
namespace
:
46c2400a-5773-4c26-be68-2e90a673259b
metadata
:
management
:
context-path
:
/actuator
gateway
:
discovery
:
#是否与服务发现组件进行结合,通过 serviceId(必须设置成大写) 转发到具体的服务实例。默认为false,设为true便开启通过服务中心的自动根据 serviceId 创建路由的功能。
locator
:
#路由访问方式:http://Gateway_HOST:Gateway_PORT/大写的serviceId/**,其中微服务应用名默认大写访问,配置lowerCaseServiceId可用小写。
enabled
:
true
lowerCaseServiceId
:
true
routes
:
-
id
:
loit-portal
uri
:
lb://loit-portal
predicates
:
-
Path=/api-portal/**
filters
:
-
StripPrefix=1
logoutSign
:
true
-
id
:
loit-file
uri
:
lb://loit-file
predicates
:
-
Path=/api-file/**
filters
:
-
StripPrefix=1
-
id
:
loit-law
uri
:
lb://loit-law
predicates
:
-
Path=/api-law/**
filters
:
-
StripPrefix=1
-
id
:
loit-form
uri
:
lb://loit-form
predicates
:
-
Path=/api-form/**
filters
:
-
StripPrefix=1
-
id
:
loit-admin-server
uri
:
lb://loit-admin-server
predicates
:
-
Path=/api-admin/**
filters
:
-
StripPrefix=1
-
id
:
loit-cas-server
uri
:
lb://loit-cas-server
predicates
:
-
Path=/loit-cas/**
filters
:
-
StripPrefix=1
casServerSign
:
true
-
id
:
loit-notice
uri
:
lb://loit-notice
predicates
:
-
Path=/api-notice/**
filters
:
-
StripPrefix=1
sentinel
:
# Sentinel 网关限流规则配置文件
datasource.ds1.nacos
:
server-addr
:
47.114.50.99:8010
namespace
:
46c2400a-5773-4c26-be68-2e90a673259b
data-id
:
${spring.application.name}-sentinel-gateway
data-type
:
json
group-id
:
DEFAULT_GROUP
# 规则类型 限流配置
ruleType
:
gw-flow
# Sentinel 网关限流API分组定义配置文件
datasource.ds2.nacos
:
server-addr
:
47.114.50.99:8010
namespace
:
46c2400a-5773-4c26-be68-2e90a673259b
data-id
:
${spring.application.name}-sentinel-api
data-type
:
json
group-id
:
DEFAULT_GROUP
# 规则类型 API分组
ruleType
:
gw-api-group
# Sentinel 网关降级规则配置
datasource.ds3.nacos
:
server-addr
:
47.114.50.99:8010
namespace
:
46c2400a-5773-4c26-be68-2e90a673259b
data-id
:
${spring.application.name}-degrade-rules
data-type
:
json
group-id
:
DEFAULT_GROUP
# 规则类型 降级
ruleType
:
degrade
## 应用与Sentinel控制台交互的端口,应用本地会起一个该端口占用的HttpServer
#transport:
## Sentinel 控制台地址
#dashboard: localhost:8090
## 应用与Sentinel控制台的心跳间隔时间
#heartbeat-interval-ms: 60000
#port: 8719
filter
:
enabled
:
true
scg.fallback
:
## Spring Cloud Gateway 熔断后的响应模式(选择 redirect or response)
mode
:
response
## Spring Cloud Gateway 响应模式为 'response' 模式对应的响应码
response-status
:
200
content-type
:
application/json
## Spring Cloud Gateway 响应模式为 'response' 模式对应的响应内容
response-body
:
'
{"success":false,"code":"444","msg":"系统繁忙请稍后再试"}'
scg
:
order
:
-100
redis
:
database
:
2
host
:
127.0.0.1
port
:
6379
jedis
:
pool
:
max-idle
:
20
min-idle
:
0
max-active
:
8
max-wait
:
-1
timeout
:
10000
#password: portal2019
# 单点登录配置
loit
:
cas
:
gateway
:
resource_auth
:
false
login_auth
:
false
kill_seconds
:
1800
gateway_debug_out
:
true
#放行路径
auth-skip
:
dataworks-servers
:
-
api-portal
no-user-servers
:
-
/loit-cas/**
no-user-uri
:
-
/image/**
-
/static/**
api-urls
:
#portal模块测试与生产环境放行接口
-
/api-portal/api/v1/feign/dict/**
-
/api-portal/cas/**
-
/api-portal/api/v1/cas/**
-
/api-portal/image/**
-
/api-portal/api/v1/dictData/**
-
/api-portal/actuator/**
-
/api-portal/actuator/health
#portal模块开发放行接口
-
/api-portal/api/v1/person/setCookie/**
-
/api-portal/api/v1/feign/org/treeList
-
/api-portal/api/v1/open/person/orgPersonList/**
-
/api-portal/login.html
-
/api-portal/static/**
-
/api-portal/api/v1/app/login
-
/api-portal/websocket
#Case单点登录放行接口
-
/loit-cas/cas/**
#swagger开发测试放行接口
-
/*/swagger-ui.html
-
/*/swagger-resources/**
-
/*/v2/api-docs
-
/*/webjars/springfox-swagger-ui/**
#file模块
#- /v1/datasetshare
#- /health
loit-gateway/src/main/resources/application.yml
0 → 100644
浏览文件 @
c54aa873
spring
:
profiles
:
active
:
dev
loit-gateway/src/main/resources/bootstrap.properties
0 → 100644
浏览文件 @
c54aa873
spring.profiles.active
=
dev
spring.application.name
=
loit-getway
# Nacos \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0135\ufffd\u05b7
spring.cloud.nacos.config.server-addr
=
47.114.50.99:8010
spring.cloud.nacos.config.namespace
=
46c2400a-5773-4c26-be68-2e90a673259b
spring.cloud.nacos.config.file-extension
=
yaml
pom.xml
0 → 100644
浏览文件 @
c54aa873
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<modules>
<module>
loit-gateway
</module>
</modules>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
2.3.3.RELEASE
</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<groupId>
com.loit
</groupId>
<artifactId>
demo
</artifactId>
<packaging>
pom
</packaging>
<version>
0.0.1-SNAPSHOT
</version>
<name>
demo
</name>
<description>
Demo project for Spring Boot
</description>
<properties>
<java.version>
1.8
</java.version>
<spring-boot-admin.version>
2.3.0
</spring-boot-admin.version>
<spring-cloud.version>
Hoxton.SR8
</spring-cloud.version>
<spring-cloud-timeloit.version>
2.3.3-SNAPSHOT
</spring-cloud-timeloit.version>
</properties>
<!--<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zookeeper</artifactId>
<!– <version>2.2.1.RELEASE</version>–>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
<!– <version>2.2.2.RELEASE</version>–>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>-->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-dependencies
</artifactId>
<version>
${spring-cloud.version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
<dependency>
<groupId>
de.codecentric
</groupId>
<artifactId>
spring-boot-admin-dependencies
</artifactId>
<version>
${spring-boot-admin.version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
<!-- 时代凌宇 基础组件 -->
<dependency>
<groupId>
com.timeloit.cloud
</groupId>
<artifactId>
spring-cloud-timeloit
</artifactId>
<version>
${spring-cloud-timeloit.version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>
nexus-releases
</id>
<name>
Nexus Release Repository
</name>
<url>
http://39.100.254.140:12010/repository/maven-releases/
</url>
</repository>
<snapshotRepository>
<id>
nexus-snapshots
</id>
<name>
Nexus Snapshot Repository
</name>
<url>
http://39.100.254.140:12010/repository/maven-snapshots/
</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>
nexus-loit-dev
</id>
<name>
Nexus Repository
</name>
<url>
http://39.100.254.140:12010/repository/maven-public/
</url>
<snapshots>
<enabled>
true
</enabled>
</snapshots>
<releases>
<enabled>
true
</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>
nexus-loit-dev
</id>
<name>
Nexus Plugin Repository
</name>
<url>
http://39.100.254.140:12010/repository/maven-public/
</url>
<snapshots>
<enabled>
true
</enabled>
</snapshots>
<releases>
<enabled>
true
</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</project>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论