Skip to content

Commit

Permalink
Merge pull request yudaocode#1 from YunaiV/master
Browse files Browse the repository at this point in the history
更新仓库
  • Loading branch information
zhixiangyuan authored Mar 4, 2020
2 parents 56cba02 + ab4a541 commit 1ba3109
Show file tree
Hide file tree
Showing 129 changed files with 4,137 additions and 132 deletions.
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
一个涵盖四个主流技术栈的**正经**仓库:
* [《Spring Boot 专栏》](https://github.com/YunaiV/SpringBoot-Labs#spring-boot-%E4%B8%93%E6%A0%8F)
* [《Spring Cloud Alibaba 专栏》](https://github.com/YunaiV/SpringBoot-Labs#spring-cloud-alibaba-%E4%B8%93%E6%A0%8F)
* [《Spring Cloud 专栏》](https://github.com/YunaiV/SpringBoot-Labs#spring-cloud-%E4%B8%93%E6%A0%8F)
* [《Dubbo 专栏》](https://github.com/YunaiV/SpringBoot-Labs#Dubbo-%E4%B8%93%E6%A0%8F)

作为一个热爱**深夜**撸码的 18 岁秃头的可爱小男孩,希望大佬能够**一键三连**

![一间三连](http://static.iocoder.cn/github-star.jpg)

> ~~交流~~**装逼群**,请点击[传送门](http://www.iocoder.cn/mall-user-group/?vip&gitee),进行引导加入。**亲,一键三连啊**
# Spring Boot 专栏

Expand Down Expand Up @@ -136,9 +147,8 @@

* [《芋道 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)
* [《芋道 Spring Cloud 声明式调用 Feign 入门》](http://www.iocoder.cn/Spring-Cloud/Feign/?github) 对应 [labx-03](https://github.com/YunaiV/SpringBoot-Labs/tree/master/labx-03)
* 《芋道 Spring Cloud 服务网关 Spring Cloud Gateway 入门》
* [《芋道 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)
* 《芋道 Spring Cloud 链路追踪 SkyWalking 入门》

* TODO 监控

# Spring Cloud 专栏
Expand Down Expand Up @@ -166,19 +176,25 @@
## 配置中心

* [《芋道 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)
* 《芋道 Spring Cloud 配置中心 Apollo 入门》
* [《芋道 Spring Cloud 配置中心 Apollo 入门》](http://www.iocoder.cn/Spring-Cloud/Apollo/?github) 对应 [labx-09](https://github.com/YunaiV/SpringBoot-Labs/tree/master/labx-09)


## 消息队列

* [《芋道 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)
* 《芋道 Spring Cloud Alibaba 消息队列 RabbitMQ 入门》
* 《芋道 Spring Cloud Alibaba 消息队列 Kafka 入门》
* [《芋道 Spring Cloud 消息队列 RabbitMQ 入门》](http://www.iocoder.cn/Spring-Cloud/RabbitMQ/?github) 对应 [lab10-06](https://github.com/YunaiV/SpringBoot-Labs/tree/master/labx-10)
* 《芋道 Spring Cloud 消息队列 Kafka 入门》

## 链路追踪

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

# Dubbo 专栏

* [《芋道 Spring Boot Dubbo 入门》](http://www.iocoder.cn/Spring-Boot/Dubbo/?github) 对应 [lab-30](https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-30)
* [《芋道 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)

---------

如下是草稿目录,未来需要整理下
Expand Down
3 changes: 3 additions & 0 deletions lab-45/lab-45-apollo-demo/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
server:
port: 7070 # 避免和本地的 Apollo Portal 端口冲突

app:
id: demo-application # 使用的 Apollo 的项目(应用)编号
apollo:
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

60 changes: 60 additions & 0 deletions labx-08/labx-08-sc-gateway-demo01-test/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?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>labx-08</artifactId>
<groupId>cn.iocoder.springboot.labs</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>labx-08-sc-gateway-demo01-test</artifactId>

<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<spring.boot.version>2.2.4.RELEASE</spring.boot.version>
<spring.cloud.version>Hoxton.SR1</spring.cloud.version>
<spring.cloud.alibaba.version>2.2.0.RELEASE</spring.cloud.alibaba.version>
</properties>

<!--
引入 Spring Boot、Spring Cloud、Spring Cloud Alibaba 三者 BOM 文件,进行依赖版本的管理,防止不兼容。
在 https://dwz.cn/mcLIfNKt 文章中,Spring Cloud Alibaba 开发团队推荐了三者的依赖关系
-->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<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>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>${spring.cloud.alibaba.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<!-- 引入 Spring Cloud Gateway 相关依赖,使用它作为网关,并实现对其的自动配置 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package cn.iocoder.springcloud.labx08.gatewaydemo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class GatewayApplication {

public static void main(String[] args) {
SpringApplication.run(GatewayApplication.class, args);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package cn.iocoder.springcloud.labx08.gatewaydemo.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.core.annotation.Order;
import reactor.core.publisher.Mono;

//@Configuration
public class GatewayConfig {

private Logger logger = LoggerFactory.getLogger(GatewayConfig.class);

@Bean
@Order(1)
public GlobalFilter firstGlobalFilter() {
return (exchange, chain) -> {
logger.info("[first][pre]");
return chain.filter(exchange)
.then(Mono.<Void>fromRunnable(() -> logger.info("[first][post]")));
};
}

@Bean
@Order(2)
public GlobalFilter secondGatewayFilter() {
return (exchange, chain) -> {
logger.info("[second][pre]");
return chain.filter(exchange)
.then(Mono.<Void>fromRunnable(() -> logger.info("[second][post]")));
};
}

@Bean
@Order(3)
public GlobalFilter thirdGlobalFilter() {
return (exchange, chain) -> {
logger.info("[third][pre]");
return chain.filter(exchange)
.then(Mono.<Void>fromRunnable(() -> logger.info("[third][post]")));
};
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
server:
port: 8888

spring:
application:
name: gateway-application

cloud:
# Spring Cloud Gateway 配置项,对应 GatewayProperties 类
gateway:
# 路由配置项,对应 RouteDefinition 数组
routes:
- id: yudaoyuanma # 路由的编号
uri: http://www.iocoder.cn # 路由到的目标地址
predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
- Path=/blog
filters:
- StripPrefix=1
- id: oschina # 路由的编号
uri: https://www.oschina.net # 路由的目标地址
predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
- Path=/oschina
filters: # 过滤器,对请求进行拦截,实现自定义的功能,对应 FilterDefinition 数组
- StripPrefix=100
# - StripPrefix=200
# default-filters:
# - StripPrefix=1
# - StripPrefix=2
# - StripPrefix=3

# httpserver:
# wiretap: true
# httpclient:
# wiretap: true

logging:
level:
reactor.netty: DEBUG
org.springframework.cloud.gateway: TRACE
# org.springframework.web.reactive: TRACE
Loading

0 comments on commit 1ba3109

Please sign in to comment.