Skip to content

Commit 9b9f786

Browse files
author
YunaiV
committed
增加 spring cloud x skywalking 链路追踪
1 parent 820a3ec commit 9b9f786

File tree

4 files changed

+80
-0
lines changed

4 files changed

+80
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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-14-sc-skywalking-springcloudgateway</artifactId>
13+
14+
<properties>
15+
<spring.boot.version>2.1.13.RELEASE</spring.boot.version>
16+
<spring.cloud.version>Greenwich.SR1</spring.cloud.version>
17+
</properties>
18+
19+
<!--
20+
引入 Spring Boot、Spring Cloud、Spring Cloud Alibaba 三者 BOM 文件,进行依赖版本的管理,防止不兼容。
21+
在 https://dwz.cn/mcLIfNKt 文章中,Spring Cloud Alibaba 开发团队推荐了三者的依赖关系
22+
-->
23+
<dependencyManagement>
24+
<dependencies>
25+
<dependency>
26+
<groupId>org.springframework.boot</groupId>
27+
<artifactId>spring-boot-starter-parent</artifactId>
28+
<version>${spring.boot.version}</version>
29+
<type>pom</type>
30+
<scope>import</scope>
31+
</dependency>
32+
<dependency>
33+
<groupId>org.springframework.cloud</groupId>
34+
<artifactId>spring-cloud-dependencies</artifactId>
35+
<version>${spring.cloud.version}</version>
36+
<type>pom</type>
37+
<scope>import</scope>
38+
</dependency>
39+
</dependencies>
40+
</dependencyManagement>
41+
42+
<dependencies>
43+
<!-- 引入 Spring Cloud Gateway 相关依赖,使用它作为网关,并实现对其的自动配置 -->
44+
<dependency>
45+
<groupId>org.springframework.cloud</groupId>
46+
<artifactId>spring-cloud-starter-gateway</artifactId>
47+
</dependency>
48+
</dependencies>
49+
50+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package cn.iocoder.springcloud.labx14.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+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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: feign-service-route
14+
uri: http://127.0.0.1:8081
15+
predicates:
16+
- Path=/**

labx-14/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<modules>
1515
<module>labx-14-sc-skywalking-springmvc</module>
1616
<module>labx-14-sc-skywalking-feign</module>
17+
<module>labx-14-sc-skywalking-springcloudgateway</module>
1718
</modules>
1819

1920
</project>

0 commit comments

Comments
 (0)