If you’re a Maven Central user, add our BOM to your pom.xml <dependencyManagement> section. This will allow you to omit versions for any of the Maven dependencies and instead delegate versioning to the BOM.
@ -7,7 +7,9 @@ Starting from 2021.0.1.0, the SCA version will correspond to the Spring Cloud ve
=== Upgrade Steps
Upgrade version (note the version correspondence)
```xml
[source,xml]
----
<dependencyManagement>
<dependency>
<groupId>org.springframework.boot</groupId>
@ -31,7 +33,7 @@ Upgrade version (note the version correspondence)
<scope>import</scope>
</dependency>
</dependencyManagement>
```
----
*Note:* The `spring-cloud-starter-alibaba-nacos-config` module removes the `spring-cloud-starter-bootstrap` dependency. If you want to use with the bootstrap way, you need to manually add this dependency, now recommended to import configuration using `spring.config.import`.
@ -43,7 +45,8 @@ After completing the above steps, you can smoothly switch to the `Spring Cloud A
Suppose there is a configuration file (`bootstrap.yml`) here, how should it be configured to upgrade to a new version?
@ -140,7 +148,9 @@ Now there are these requirements:
3. I want to configure a circuit breaker for the specified method (error) of order FeignClient.
Add the following configuration.
```yaml
[source,yaml]
----
feign:
circuitbreaker:
enabled: true
@ -171,7 +181,7 @@ feign:
timeWindow: 1
statIntervalMs: 1000
minRequestAmount: 5
```
----
This feature also supports dynamic refresh from the configuration center. You can put the above configuration into the configuration center (nacos, consul), and the modified rules will take effect immediately. If you do not need this feature, you can set `feign.sentinel.enable-refresh-rules=false` to disable it.
- Seata supports the Seata console since version 1.5.0, and the local access console address: 'http://127.0.0.1:7091'.
- Through the Seata console, you can observe the executing transaction information and global lock information, and delete the relevant information when the transaction is completed.
@ -16,16 +16,18 @@ https://github.com/alibaba/Sentinel[Sentinel] has the following features:
If you want to use Sentinel in your project, please use the starter with the group ID as `com.alibaba.cloud` and the artifact ID as `spring-cloud-starter-alibaba-sentinel`.
The following is a simple example of how to use Sentinel:
```java
[source,java]
----
@SpringBootApplication
public class Application {
@ -45,7 +47,7 @@ public class TestController {
}
}
```
----
The @SentinelResource annotation is used to identify if a resource is rate limited or degraded. In the above sample, the 'hello' attribute of the annotation refers to the resource name.
@ -53,7 +55,8 @@ The @SentinelResource annotation is used to identify if a resource is rate limit
The above examples are all used in the WebServlet environment. Sentinel currently supports WebFlux and needs to cooperate with the `spring-boot-starter-webflux` dependency to trigger the WebFlux-related automation configuration in sentinel starter.
```java
[source,java]
----
@SpringBootApplication
public class Application {
@ -74,12 +77,11 @@ public class TestController {
}
}
```
----
===== Sentinel Dashboard
Sentinel dashboard is a lightweight console that provides functions such as machine discovery, single-server resource monitoring, overview of cluster resource data, as well as rule management. To use these features, you only need to complete a few steps.
The Sentinel community provides a lightweight console that provides machine discovery, real-time monitoring of stand-alone resources, cluster resource aggregation, and rule management. All you need is a simple configuration of your app to use these features.
*Note*: The statistics overview for clusters only supports clusters with less than 500 nodes, and has a latency of about 1 to 2 seconds.
.Sentinel Dashboard
@ -101,9 +103,10 @@ You can also get the latest source code to build your own Sentinel dashboard:
Sentinel dashboard is a standard SpringBoot application, and you can run the JAR file in the Spring Boot mode.
@ -159,7 +165,7 @@ class EchoServiceFallback implements EchoService {
return "echo fallback";
}
}
```
----
NOTE: The resource name policy in the corresponding interface of Feign is:httpmethod:protocol://requesturl. All the attributes in the `@FeignClient` annotation is supported by Sentinel.
@ -169,13 +175,14 @@ The corresponding resource name of the `echo` method in the `EchoService` interf
Spring Cloud Alibaba Sentinel supports the protection of `RestTemplate` service calls using Sentinel. To do this, you need to add the `@SentinelRestTemplate` annotation when constructing the `RestTemplate` bean.
The attribute of the `@SentinelRestTemplate` annotation support flow control(`blockHandler`, `blockHandlerClass`) and circuit breaking(`fallback`, `fallbackClass`).
@ -187,13 +194,14 @@ The parameter and return value of method in `@SentinelRestTemplate` is same as `
The method signature of `handleException` in `ExceptionUtil` above should be like this:
NOTE: When the application starts, it will check if the `@SentinelRestTemplate` annotation corresponding to the flow control or circuit breaking method exists, if it does not exist, it will throw an exception.
If you want to use Sentinel Starter with Spring Cloud Gateway, you need to add the `spring-cloud-alibaba-sentinel-gateway` dependency and add the `spring-cloud-starter-gateway` dependency to let Spring Cloud Gateway AutoConfiguration class in the module takes effect: