-
Notifications
You must be signed in to change notification settings - Fork 8.5k
update spring boot, spring cloud, nacos client versions #4003
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2023.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |
| <parent> | ||
| <groupId>org.springframework.cloud</groupId> | ||
| <artifactId>spring-cloud-dependencies-parent</artifactId> | ||
| <version>4.1.0</version> | ||
| <version>4.3.0</version> | ||
| <relativePath/> | ||
| </parent> | ||
|
|
||
|
|
@@ -18,15 +18,16 @@ | |
| <description>Spring Cloud Alibaba Dependencies</description> | ||
|
|
||
| <properties> | ||
| <revision>2023.0.3.3</revision> | ||
| <revision>2025.0.0.0</revision> | ||
| <sentinel.version>1.8.8</sentinel.version> | ||
| <nacos.client.version>2.4.2</nacos.client.version> | ||
| <seata.version>2.1.0</seata.version> | ||
| <nacos.client.version>3.0.1</nacos.client.version> | ||
| <seata.version>2.3.0</seata.version> | ||
| <!-- Apache RocketMQ --> | ||
| <rocketmq.version>5.3.1</rocketmq.version> | ||
| <rocketmq.version>5.3.3</rocketmq.version> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hi, 在升级时有运行项目中的 example 例子吗?确保 example 正常运行且符合预期很有必要 |
||
| <rocketmq.acl.version>5.3.2</rocketmq.acl.version> | ||
|
|
||
| <!-- scheduling --> | ||
| <shedlock.version>4.23.0</shedlock.version> | ||
| <shedlock.version>6.9.0</shedlock.version> | ||
| <schedulerx.worker.version>1.11.4</schedulerx.worker.version> | ||
|
|
||
| <!-- Maven Plugin Versions --> | ||
|
|
@@ -167,7 +168,7 @@ | |
| <dependency> | ||
| <groupId>org.apache.rocketmq</groupId> | ||
| <artifactId>rocketmq-acl</artifactId> | ||
| <version>${rocketmq.version}</version> | ||
| <version>${rocketmq.acl.version}</version> | ||
| </dependency> | ||
|
|
||
| <!-- Alibaba scheduling --> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,10 +18,12 @@ | |
|
|
||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import java.util.concurrent.Future; | ||
|
|
||
| import com.alibaba.nacos.api.exception.NacosException; | ||
| import com.alibaba.nacos.api.naming.NamingService; | ||
| import com.alibaba.nacos.api.naming.listener.EventListener; | ||
| import com.alibaba.nacos.api.naming.listener.FuzzyWatchEventWatcher; | ||
| import com.alibaba.nacos.api.naming.pojo.Instance; | ||
| import com.alibaba.nacos.api.naming.pojo.ListView; | ||
| import com.alibaba.nacos.api.naming.pojo.ServiceInfo; | ||
|
|
@@ -370,4 +372,35 @@ public void unsubscribe(String s, NamingSelector namingSelector, EventListener e | |
| public void unsubscribe(String s, String s1, NamingSelector namingSelector, EventListener eventListener) throws NacosException { | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void fuzzyWatch(String groupNamePattern, FuzzyWatchEventWatcher listener) throws NacosException { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里文件的作用是什么?似乎它时一个空的 Mock 文件? |
||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void fuzzyWatch(String serviceNamePattern, String groupNamePattern, FuzzyWatchEventWatcher listener) throws NacosException { | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public Future<ListView<String>> fuzzyWatchWithServiceKeys(String groupNamePattern, FuzzyWatchEventWatcher listener) throws NacosException { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public Future<ListView<String>> fuzzyWatchWithServiceKeys(String serviceNamePattern, String groupNamePattern, FuzzyWatchEventWatcher listener) throws NacosException { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public void cancelFuzzyWatch(String groupNamePattern, FuzzyWatchEventWatcher listener) throws NacosException { | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void cancelFuzzyWatch(String serviceNamePattern, String groupNamePattern, FuzzyWatchEventWatcher listener) throws NacosException { | ||
|
|
||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| /* | ||
| * Copyright 2013-2023 the original author or authors. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 版权年份应该是 2013-2025 |
||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package com.alibaba.cloud.sentinel.rest; | ||
|
|
||
| import java.io.ByteArrayInputStream; | ||
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
|
|
||
| import org.springframework.http.HttpHeaders; | ||
| import org.springframework.http.HttpInputMessage; | ||
| import org.springframework.util.Assert; | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 多了一个空行,下文也是 |
||
|
|
||
| public class BaseHttpInputMessage implements HttpInputMessage { | ||
|
|
||
| private final HttpHeaders headers = new HttpHeaders(); | ||
| private final InputStream body; | ||
|
|
||
|
|
||
| /** | ||
| * Create a {@code MockHttpInputMessage} with the supplied body. | ||
| */ | ||
| public BaseHttpInputMessage(byte[] body) { | ||
| Assert.notNull(body, "Byte array must not be null"); | ||
| this.body = new ByteArrayInputStream(body); | ||
| } | ||
|
|
||
| /** | ||
| * Create a {@code MockHttpInputMessage} with the supplied body. | ||
| */ | ||
| public BaseHttpInputMessage(InputStream body) { | ||
| Assert.notNull(body, "InputStream must not be null"); | ||
| this.body = body; | ||
| } | ||
|
|
||
|
|
||
| @Override | ||
| public HttpHeaders getHeaders() { | ||
| return this.headers; | ||
| } | ||
|
|
||
| @Override | ||
| public InputStream getBody() throws IOException { | ||
| return this.body; | ||
| } | ||
|
|
||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,66 +16,95 @@ | |
|
|
||
| package com.alibaba.cloud.sentinel.rest; | ||
|
|
||
| import java.io.ByteArrayInputStream; | ||
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
| import java.util.Arrays; | ||
| import java.util.HashMap; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| import com.alibaba.cloud.sentinel.annotation.SentinelRestTemplate; | ||
| import com.alibaba.cloud.sentinel.custom.SentinelProtectInterceptor; | ||
|
|
||
| import org.springframework.http.HttpHeaders; | ||
| import org.springframework.http.HttpStatus; | ||
| import org.springframework.http.MediaType; | ||
| import org.springframework.http.client.AbstractClientHttpResponse; | ||
| import org.springframework.http.HttpStatusCode; | ||
| import org.springframework.http.client.ClientHttpResponse; | ||
| import org.springframework.util.Assert; | ||
|
|
||
| /** | ||
| * Using by {@link SentinelRestTemplate} and {@link SentinelProtectInterceptor}. | ||
| * | ||
| * @author <a href="mailto:fangjian0423@gmail.com">Jim</a> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 尽量不要删除这里的作者签名 |
||
| */ | ||
| public class SentinelClientHttpResponse extends AbstractClientHttpResponse { | ||
|
|
||
| private String blockResponse = "RestTemplate request block by sentinel"; | ||
| public class SentinelClientHttpResponse extends BaseHttpInputMessage implements ClientHttpResponse { | ||
|
|
||
| private final HttpStatusCode statusCode; | ||
|
|
||
| private static final String BLOCK_RESPONSE = "RestTemplate request block by sentinel"; | ||
| //private String blockResponse = BLOCK_RESPONSE; | ||
|
|
||
| /** | ||
| * Create a {@code SentinelMyClientHttpResponse} with an empty response body and | ||
| * HTTP status code {@link HttpStatus#OK OK}. | ||
| * | ||
| * @since 6.0.3 | ||
| */ | ||
| public SentinelClientHttpResponse() { | ||
| this(BLOCK_RESPONSE.getBytes(), HttpStatus.OK); | ||
| } | ||
|
|
||
| public SentinelClientHttpResponse(String blockResponse) { | ||
| this.blockResponse = blockResponse; | ||
| this(blockResponse.getBytes(), HttpStatus.OK); | ||
| } | ||
|
|
||
| @Override | ||
| public int getRawStatusCode() throws IOException { | ||
| return HttpStatus.OK.value(); | ||
| /** | ||
| * Create a {@code SentinelMyClientHttpResponse} with response body as a byte array | ||
| * and the supplied HTTP status code. | ||
| */ | ||
| public SentinelClientHttpResponse(byte[] body, HttpStatusCode statusCode) { | ||
| super(body); | ||
| Assert.notNull(statusCode, "HttpStatusCode must not be null"); | ||
| this.statusCode = statusCode; | ||
| } | ||
|
|
||
| @Override | ||
| public String getStatusText() throws IOException { | ||
| return blockResponse; | ||
| /** | ||
| * Create a {@code SentinelMyClientHttpResponse} with response body as a byte array | ||
| * and a custom HTTP status code. | ||
| * | ||
| * @since 5.3.17 | ||
| */ | ||
| public SentinelClientHttpResponse(byte[] body, int statusCode) { | ||
| this(body, HttpStatusCode.valueOf(statusCode)); | ||
| } | ||
|
|
||
| /** | ||
| * Create a {@code SentinelMyClientHttpResponse} with response body as {@link InputStream} | ||
| * and the supplied HTTP status code. | ||
| */ | ||
| public SentinelClientHttpResponse(InputStream body, HttpStatusCode statusCode) { | ||
| super(body); | ||
| Assert.notNull(statusCode, "HttpStatusCode must not be null"); | ||
| this.statusCode = statusCode; | ||
| } | ||
|
|
||
| /** | ||
| * Create a {@code SentinelMyClientHttpResponse} with response body as {@link InputStream} | ||
| * and a custom HTTP status code. | ||
| * | ||
| * @since 5.3.17 | ||
| */ | ||
| public SentinelClientHttpResponse(InputStream body, int statusCode) { | ||
| this(body, HttpStatusCode.valueOf(statusCode)); | ||
| } | ||
|
|
||
|
|
||
| @Override | ||
| public void close() { | ||
| // nothing do | ||
| public HttpStatusCode getStatusCode() { | ||
| return this.statusCode; | ||
| } | ||
|
|
||
| @Override | ||
| public InputStream getBody() throws IOException { | ||
| return new ByteArrayInputStream(blockResponse.getBytes()); | ||
| public String getStatusText() { | ||
| return (this.statusCode instanceof HttpStatus status ? status.getReasonPhrase() : ""); | ||
| } | ||
|
|
||
| @Override | ||
| public HttpHeaders getHeaders() { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hi, 我看到这里是移到了 BaseHttpInputMessage 类中吗? |
||
| Map<String, List<String>> headers = new HashMap<>(); | ||
| headers.put(HttpHeaders.CONTENT_TYPE, | ||
| Arrays.asList(MediaType.APPLICATION_JSON_VALUE)); | ||
| HttpHeaders httpHeaders = new HttpHeaders(); | ||
| httpHeaders.putAll(headers); | ||
| return httpHeaders; | ||
| public void close() { | ||
| try { | ||
| getBody().close(); | ||
| } | ||
| catch (IOException ex) { | ||
| // ignore | ||
| } | ||
| } | ||
|
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以在文件末尾加一个换行
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206