Skip to content

Commit 0d7ae63

Browse files
flystar32EndlessSeeker
authored andcommitted
update spring boot version to latest
1 parent 08c98db commit 0d7ae63

File tree

6 files changed

+39
-35
lines changed

6 files changed

+39
-35
lines changed

mse-simple-demo/A/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@
142142
<groupId>org.springframework.boot</groupId>
143143
<artifactId>spring-boot-maven-plugin</artifactId>
144144
<version>${spring-boot.version}</version>
145+
<executions>
146+
<execution>
147+
<goals>
148+
<goal>repackage</goal>
149+
</goals>
150+
</execution>
151+
</executions>
145152
</plugin>
146153
</plugins>
147154
<finalName>${project.artifactId}</finalName>

mse-simple-demo/A/src/main/java/com/alibabacloud/mse/demo/a/AController.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import java.util.concurrent.ExecutionException;
3232

3333
@RestController
34-
class AController {
34+
public class AController {
3535
private static final Logger log = LoggerFactory.getLogger(AController.class);
3636

3737
@Autowired
@@ -82,17 +82,17 @@ public String a() throws ExecutionException, InterruptedException {
8282
//这是rpc调用的方式
8383
String result = restTemplate.getForObject("http://sc-B/b", String.class);
8484

85-
return "A[tag=" + serviceTag + "][" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
85+
return "A" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
8686
"[config=" + configValue + "]" + " -> " + result;
8787
}
8888

8989
@Operation(summary = "HTTP 全链路灰度入口 a调用b和c", tags = {"入口应用"})
9090
@GetMapping("/a2bc")
9191
public String a2bc() throws ExecutionException, InterruptedException {
9292

93-
String resultB = "A[tag=" + serviceTag + "][" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
93+
String resultB = "A" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
9494
"[config=" + configValue + "]" + " -> " + restTemplate.getForObject("http://sc-B/b", String.class);
95-
String resultA = "A[tag=" + serviceTag + "][" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
95+
String resultA = "A" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
9696
"[config=" + configValue + "]" + " -> " + restTemplate.getForObject("http://sc-C/c", String.class);
9797

9898
return resultA + "\n" + resultB;
@@ -104,7 +104,7 @@ public String aByFeign() throws ExecutionException, InterruptedException {
104104

105105
String result = feignClient.bByFeign("test");
106106

107-
return "A[tag=" + serviceTag + "][" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
107+
return "A" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
108108
"[config=" + configValue + "]" + " -> " + result;
109109
}
110110

@@ -116,7 +116,7 @@ public String flow() throws ExecutionException, InterruptedException {
116116
HttpStatusCode status = responseEntity.getStatusCode();
117117
String result = responseEntity.getBody() + " code:" + status.value();
118118

119-
return "A[tag=" + serviceTag + "][" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
119+
return "A" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
120120
"[config=" + configValue + "]" + " -> " + result;
121121
}
122122

@@ -129,7 +129,7 @@ public String params(@PathVariable("hot") String hot) throws ExecutionException,
129129
HttpStatusCode status = responseEntity.getStatusCode();
130130
String result = responseEntity.getBody() + " code:" + status.value();
131131

132-
return "A[tag=" + serviceTag + "][" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
132+
return "A" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
133133
"[config=" + configValue + "]" + " params:" + hot + " -> " + result;
134134
}
135135

@@ -141,7 +141,7 @@ public String isolate() throws ExecutionException, InterruptedException {
141141
HttpStatusCode status = responseEntity.getStatusCode();
142142
String result = responseEntity.getBody() + " code:" + status.value();
143143

144-
return "A[tag=" + serviceTag + "][" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
144+
return "A" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
145145
"[config=" + configValue + "]" + " -> " + result;
146146
}
147147

@@ -156,50 +156,50 @@ public String sql(@RequestParam Map<String, String> allRequestParams) throws Uns
156156
url.append("&");
157157
}
158158
String result = restTemplate.getForObject(url.toString(), String.class);
159-
return "A[tag=" + serviceTag + "][" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
159+
return "A" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
160160
"[config=" + configValue + "]" + " -> " + result;
161161
}
162162

163163
@Operation(summary = "HTTP 全链路灰度入口", tags = {"入口应用"})
164164
@GetMapping("/a-zone")
165165
public String aZone() {
166-
return "A[tag=" + serviceTag + "][" + currentZone + "]" + " -> " +
166+
return "A" + serviceTag + "[" + currentZone + "]" + " -> " +
167167
restTemplate.getForObject("http://sc-B/b-zone", String.class);
168168
}
169169

170170
@Operation(summary = "Dubbo 全链路灰度入口", tags = {"入口应用"})
171171
@GetMapping("/dubbo")
172172
public String dubbo(@RequestParam(required = false) String param) {
173-
return "A[tag=" + serviceTag + "][" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" + " -> " +
173+
return "A" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" + " -> " +
174174
helloServiceB.hello(param);
175175
}
176176

177177

178178
@Operation(summary = "Dubbo 全链路灰度入口", tags = {"入口应用"})
179179
@GetMapping("/dubbo2")
180180
public String dubbo2(@RequestParam Map<String,String> allRequestParams) {
181-
return "A[tag=" + serviceTag + "][" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" + " -> " +
181+
return "A" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" + " -> " +
182182
helloServiceBTwo.hello2(JSON.toJSONString(allRequestParams));
183183
}
184184

185185
@Operation(summary = "Dubbo 限流测试", tags = {"入口应用"})
186186
@GetMapping("/dubbo-flow")
187187
public String dubbo_flow() {
188-
return "A[tag=" + serviceTag + "][" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" + " -> " +
188+
return "A" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" + " -> " +
189189
helloServiceB.hello("A");
190190
}
191191

192192
@Operation(summary = "Dubbo 热点测试", tags = {"入口应用"})
193193
@GetMapping("/dubbo-params/{hot}")
194194
public String dubbo_params(@PathVariable("hot") String hot) {
195-
return "A[tag=" + serviceTag + "][" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" + " params:" + hot + " -> " +
195+
return "A" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" + " params:" + hot + " -> " +
196196
helloServiceB.hello(hot);
197197
}
198198

199199
@Operation(summary = "Dubbo 隔离测试", tags = {"入口应用"})
200200
@GetMapping("/dubbo-isolate")
201201
public String dubbo_isolate() {
202-
return "A[tag=" + serviceTag + "][" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" + " -> " +
202+
return "A" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" + " -> " +
203203
helloServiceB.hello("isolate");
204204
}
205205

@@ -209,7 +209,7 @@ public String circuit_breaker_rt() throws ExecutionException, InterruptedExcepti
209209

210210
String result = feignClient.circuit_breaker_rt_b();
211211

212-
return "A[tag=" + serviceTag + "][" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
212+
return "A" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
213213
"[config=" + configValue + "]" + " -> " + result;
214214
}
215215

@@ -218,7 +218,7 @@ public String circuit_breaker_rt() throws ExecutionException, InterruptedExcepti
218218
public String circuit_breaker_exception() throws ExecutionException, InterruptedException {
219219
String result = feignClient.circuit_breaker_exception_b();
220220

221-
return "A[tag=" + serviceTag + "][" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
221+
return "A" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" +
222222
"[config=" + configValue + "]" + " -> " + result;
223223
}
224224

@@ -233,7 +233,7 @@ public String swagger(@Parameter(name = "name", description = "我是姓名", re
233233
@Operation(summary = "Dubbo rt 熔断测试", tags = {"入口应用"})
234234
@GetMapping("/dubbo-circuit-breaker-rt")
235235
public String dubbo_circuit_breaker_rt() {
236-
return "A[tag=" + serviceTag + "][" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" + " -> " +
236+
return "A" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" + " -> " +
237237
helloServiceB.slow();
238238
}
239239

@@ -250,6 +250,6 @@ public String dubbo_circuit_breaker_exception() {
250250
response = "Service is in abnormal status and throws exception by itself!";
251251
}
252252
}
253-
return "A[tag=" + serviceTag + "][" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" + " -> " + response;
253+
return "A" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" + " -> " + response;
254254
}
255255
}

mse-simple-demo/SpringCloudGateway/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# syntax=docker/dockerfile:1.4
2-
FROM maven:3-eclipse-temurin-8 as build
2+
FROM maven:3.9.9-eclipse-temurin-17 as build
33

44
# copy arthas
55
COPY --from=hengyunabc/arthas:latest /opt/arthas /opt/arthas
@@ -26,7 +26,7 @@ RUN --mount=type=cache,target=/root/.m2/repository/ \
2626
mvn clean package --batch-mode
2727

2828

29-
FROM eclipse-temurin:8-jdk
29+
FROM eclipse-temurin:17-jdk
3030

3131
RUN apt-get update && apt-get install -y \
3232
vim unzip netcat-openbsd telnet tcpdump iproute2 lsof \

mse-simple-demo/SpringCloudGateway/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
export REGISTRY=${REGISTRY}
33

44
export appName=spring-cloud-gateway
5-
export VERSION="${VERSION:-3.0.8}"
5+
export VERSION="${VERSION:-3.1.0}"
66

77
set -e
88

mse-simple-demo/SpringCloudGateway/pom.xml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
<properties>
1111
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1212
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
13-
<java.version>8</java.version>
14-
<spring-boot.version>2.1.0.RELEASE</spring-boot.version>
15-
<spring-cloud.version>Greenwich.SR3</spring-cloud.version>
16-
<spring-cloud-alibaba.version>2.1.1.RELEASE</spring-cloud-alibaba.version>
13+
<java.version>17</java.version>
14+
<spring-boot.version>3.2.4</spring-boot.version>
15+
<spring-cloud.version>2023.0.1</spring-cloud.version>
16+
<spring-cloud-alibaba.version>2023.0.1.0</spring-cloud-alibaba.version>
1717
</properties>
1818

1919
<dependencies>
@@ -82,9 +82,6 @@
8282
<groupId>org.springframework.boot</groupId>
8383
<artifactId>spring-boot-maven-plugin</artifactId>
8484
<version>${spring-boot.version}</version>
85-
<configuration>
86-
<mainClass>com.alibabcloud.mse.demo.SpringCloudGatewayApplication</mainClass>
87-
</configuration>
8885
<executions>
8986
<execution>
9087
<id>repackage</id>

mse-simple-demo/SpringCloudGateway/src/main/resources/application.properties

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ spring.cloud.nacos.discovery.namespace=${nacos.namespace}
99

1010

1111
spring.cloud.gateway.routes[0].id=sc-A
12-
spring.cloud.gateway.routes[0].uri=lb://sc-A:20001
12+
spring.cloud.gateway.routes[0].uri=lb://sc-A
1313
spring.cloud.gateway.routes[0].predicates[0]=Path=/A/**
14-
spring.cloud.gateway.routes[0].filters[0]=RewritePath=/A/, /
14+
spring.cloud.gateway.routes[0].filters[0]=RewritePath=/A/(?<segment>.*), /${segment}
1515

1616

1717
spring.cloud.gateway.routes[1].id=sc-B
18-
spring.cloud.gateway.routes[1].uri=lb://sc-B:20002
18+
spring.cloud.gateway.routes[1].uri=lb://sc-B
1919
spring.cloud.gateway.routes[1].predicates[0]=Path=/B/**
20-
spring.cloud.gateway.routes[1].filters[0]=RewritePath=/B/, /
20+
spring.cloud.gateway.routes[1].filters[0]=RewritePath=/B/(?<segment>.*), /${segment}
2121

2222

2323

2424
spring.cloud.gateway.routes[2].id=sc-C
25-
spring.cloud.gateway.routes[2].uri=lb://sc-C:20003
25+
spring.cloud.gateway.routes[2].uri=lb://sc-C
2626
spring.cloud.gateway.routes[2].predicates[0]=Path=/C/**
27-
spring.cloud.gateway.routes[2].filters[0]=RewritePath=/C/, /
27+
spring.cloud.gateway.routes[2].filters[0]=RewritePath=/C/(?<segment>.*), /${segment}
2828

2929

3030

0 commit comments

Comments
 (0)