Skip to content

Commit 1ba3109

Browse files
authored
Merge pull request #1 from YunaiV/master
更新仓库
2 parents 56cba02 + ab4a541 commit 1ba3109

File tree

129 files changed

+4137
-132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+4137
-132
lines changed

README.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
一个涵盖四个主流技术栈的**正经**仓库:
2+
* [《Spring Boot 专栏》](https://github.com/YunaiV/SpringBoot-Labs#spring-boot-%E4%B8%93%E6%A0%8F)
3+
* [《Spring Cloud Alibaba 专栏》](https://github.com/YunaiV/SpringBoot-Labs#spring-cloud-alibaba-%E4%B8%93%E6%A0%8F)
4+
* [《Spring Cloud 专栏》](https://github.com/YunaiV/SpringBoot-Labs#spring-cloud-%E4%B8%93%E6%A0%8F)
5+
* [《Dubbo 专栏》](https://github.com/YunaiV/SpringBoot-Labs#Dubbo-%E4%B8%93%E6%A0%8F)
6+
7+
作为一个热爱**深夜**撸码的 18 岁秃头的可爱小男孩,希望大佬能够**一键三连**
8+
9+
![一间三连](http://static.iocoder.cn/github-star.jpg)
10+
11+
> ~~交流~~**装逼群**,请点击[传送门](http://www.iocoder.cn/mall-user-group/?vip&gitee),进行引导加入。**亲,一键三连啊**
112
213
# Spring Boot 专栏
314

@@ -136,9 +147,8 @@
136147

137148
* [《芋道 Spring Cloud Netflix 负载均衡 Ribbon 入门》](http://www.iocoder.cn/Spring-Cloud-Netflix/Ribbon/?github) 对应 [labx-02](https://github.com/YunaiV/SpringBoot-Labs/tree/master/labx-02)
138149
* [《芋道 Spring Cloud 声明式调用 Feign 入门》](http://www.iocoder.cn/Spring-Cloud/Feign/?github) 对应 [labx-03](https://github.com/YunaiV/SpringBoot-Labs/tree/master/labx-03)
139-
* 《芋道 Spring Cloud 服务网关 Spring Cloud Gateway 入门》
150+
* [《芋道 Spring Cloud 服务网关 Spring Cloud Gateway 入门》](http://www.iocoder.cn/Spring-Cloud/Spring-Cloud-Gateway/?github) 对应 [labx-08](https://github.com/YunaiV/SpringBoot-Labs/tree/master/labx-08)
140151
* 《芋道 Spring Cloud 链路追踪 SkyWalking 入门》
141-
142152
* TODO 监控
143153

144154
# Spring Cloud 专栏
@@ -166,19 +176,25 @@
166176
## 配置中心
167177

168178
* [《芋道 Spring Cloud Alibaba 配置中心 Nacos 入门》](http://www.iocoder.cn/Spring-Cloud-Alibaba/Nacos-Config/?github) 对应 [labx-05](https://github.com/YunaiV/SpringBoot-Labs/tree/master/labx-05)
169-
* 《芋道 Spring Cloud 配置中心 Apollo 入门》
179+
* [《芋道 Spring Cloud 配置中心 Apollo 入门》](http://www.iocoder.cn/Spring-Cloud/Apollo/?github) 对应 [labx-09](https://github.com/YunaiV/SpringBoot-Labs/tree/master/labx-09)
180+
170181

171182
## 消息队列
172183

173184
* [《芋道 Spring Cloud Alibaba 消息队列 RocketMQ 入门》](http://www.iocoder.cn/Spring-Cloud-Alibaba/RocketMQ/?github) 对应 [labx-06](https://github.com/YunaiV/SpringBoot-Labs/tree/master/labx-06)
174-
* 《芋道 Spring Cloud Alibaba 消息队列 RabbitMQ 入门》
175-
* 《芋道 Spring Cloud Alibaba 消息队列 Kafka 入门》
185+
* [《芋道 Spring Cloud 消息队列 RabbitMQ 入门》](http://www.iocoder.cn/Spring-Cloud/RabbitMQ/?github) 对应 [lab10-06](https://github.com/YunaiV/SpringBoot-Labs/tree/master/labx-10)
186+
* 《芋道 Spring Cloud 消息队列 Kafka 入门》
176187

177188
## 链路追踪
178189

179190
* 《芋道 Spring Cloud 链路追踪 Sleuth 入门》
180191
* 《芋道 Spring Cloud 链路追踪 SkyWalking 入门》
181192

193+
# Dubbo 专栏
194+
195+
* [《芋道 Spring Boot Dubbo 入门》](http://www.iocoder.cn/Spring-Boot/Dubbo/?github) 对应 [lab-30](https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-30)
196+
* [《芋道 Spring Cloud Alibaba 服务调用 Dubbo 入门》](http://www.iocoder.cn/Spring-Cloud-Alibaba/Dubbo/?github) 对应 [labx-07](https://github.com/YunaiV/SpringBoot-Labs/tree/master/labx-07)
197+
182198
---------
183199

184200
如下是草稿目录,未来需要整理下

lab-45/lab-45-apollo-demo/src/main/resources/application.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
server:
2+
port: 7070 # 避免和本地的 Apollo Portal 端口冲突
3+
14
app:
25
id: demo-application # 使用的 Apollo 的项目(应用)编号
36
apollo:

labx-06/labx-06-sca-stream-rocketmq-consumer-actuator/target/classes/application.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

labx-06/labx-06-sca-stream-rocketmq-consumer-error-handler/target/classes/application.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

labx-06/labx-06-sca-stream-rocketmq-consumer-orderly/target/classes/application.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

labx-06/labx-06-sca-stream-rocketmq-producer-orderly/target/classes/application.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>labx-08</artifactId>
7+
<groupId>cn.iocoder.springboot.labs</groupId>
8+
<version>1.0-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>labx-08-sc-gateway-demo01-test</artifactId>
13+
14+
<properties>
15+
<maven.compiler.target>1.8</maven.compiler.target>
16+
<maven.compiler.source>1.8</maven.compiler.source>
17+
<spring.boot.version>2.2.4.RELEASE</spring.boot.version>
18+
<spring.cloud.version>Hoxton.SR1</spring.cloud.version>
19+
<spring.cloud.alibaba.version>2.2.0.RELEASE</spring.cloud.alibaba.version>
20+
</properties>
21+
22+
<!--
23+
引入 Spring Boot、Spring Cloud、Spring Cloud Alibaba 三者 BOM 文件,进行依赖版本的管理,防止不兼容。
24+
在 https://dwz.cn/mcLIfNKt 文章中,Spring Cloud Alibaba 开发团队推荐了三者的依赖关系
25+
-->
26+
<dependencyManagement>
27+
<dependencies>
28+
<dependency>
29+
<groupId>org.springframework.boot</groupId>
30+
<artifactId>spring-boot-starter-parent</artifactId>
31+
<version>${spring.boot.version}</version>
32+
<type>pom</type>
33+
<scope>import</scope>
34+
</dependency>
35+
<dependency>
36+
<groupId>org.springframework.cloud</groupId>
37+
<artifactId>spring-cloud-dependencies</artifactId>
38+
<version>${spring.cloud.version}</version>
39+
<type>pom</type>
40+
<scope>import</scope>
41+
</dependency>
42+
<dependency>
43+
<groupId>com.alibaba.cloud</groupId>
44+
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
45+
<version>${spring.cloud.alibaba.version}</version>
46+
<type>pom</type>
47+
<scope>import</scope>
48+
</dependency>
49+
</dependencies>
50+
</dependencyManagement>
51+
52+
<dependencies>
53+
<!-- 引入 Spring Cloud Gateway 相关依赖,使用它作为网关,并实现对其的自动配置 -->
54+
<dependency>
55+
<groupId>org.springframework.cloud</groupId>
56+
<artifactId>spring-cloud-starter-gateway</artifactId>
57+
</dependency>
58+
</dependencies>
59+
60+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package cn.iocoder.springcloud.labx08.gatewaydemo;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class GatewayApplication {
8+
9+
public static void main(String[] args) {
10+
SpringApplication.run(GatewayApplication.class, args);
11+
}
12+
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package cn.iocoder.springcloud.labx08.gatewaydemo.config;
2+
3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
5+
import org.springframework.cloud.gateway.filter.GlobalFilter;
6+
import org.springframework.context.annotation.Bean;
7+
import org.springframework.core.annotation.Order;
8+
import reactor.core.publisher.Mono;
9+
10+
//@Configuration
11+
public class GatewayConfig {
12+
13+
private Logger logger = LoggerFactory.getLogger(GatewayConfig.class);
14+
15+
@Bean
16+
@Order(1)
17+
public GlobalFilter firstGlobalFilter() {
18+
return (exchange, chain) -> {
19+
logger.info("[first][pre]");
20+
return chain.filter(exchange)
21+
.then(Mono.<Void>fromRunnable(() -> logger.info("[first][post]")));
22+
};
23+
}
24+
25+
@Bean
26+
@Order(2)
27+
public GlobalFilter secondGatewayFilter() {
28+
return (exchange, chain) -> {
29+
logger.info("[second][pre]");
30+
return chain.filter(exchange)
31+
.then(Mono.<Void>fromRunnable(() -> logger.info("[second][post]")));
32+
};
33+
}
34+
35+
@Bean
36+
@Order(3)
37+
public GlobalFilter thirdGlobalFilter() {
38+
return (exchange, chain) -> {
39+
logger.info("[third][pre]");
40+
return chain.filter(exchange)
41+
.then(Mono.<Void>fromRunnable(() -> logger.info("[third][post]")));
42+
};
43+
}
44+
45+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
server:
2+
port: 8888
3+
4+
spring:
5+
application:
6+
name: gateway-application
7+
8+
cloud:
9+
# Spring Cloud Gateway 配置项,对应 GatewayProperties 类
10+
gateway:
11+
# 路由配置项,对应 RouteDefinition 数组
12+
routes:
13+
- id: yudaoyuanma # 路由的编号
14+
uri: http://www.iocoder.cn # 路由到的目标地址
15+
predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
16+
- Path=/blog
17+
filters:
18+
- StripPrefix=1
19+
- id: oschina # 路由的编号
20+
uri: https://www.oschina.net # 路由的目标地址
21+
predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
22+
- Path=/oschina
23+
filters: # 过滤器,对请求进行拦截,实现自定义的功能,对应 FilterDefinition 数组
24+
- StripPrefix=100
25+
# - StripPrefix=200
26+
# default-filters:
27+
# - StripPrefix=1
28+
# - StripPrefix=2
29+
# - StripPrefix=3
30+
31+
# httpserver:
32+
# wiretap: true
33+
# httpclient:
34+
# wiretap: true
35+
36+
logging:
37+
level:
38+
reactor.netty: DEBUG
39+
org.springframework.cloud.gateway: TRACE
40+
# org.springframework.web.reactive: TRACE

0 commit comments

Comments
 (0)