mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
merge from 2.2.4.RELEASE
This commit is contained in:
@@ -22,6 +22,11 @@
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-sentinel-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
@@ -35,10 +40,10 @@
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>com.alibaba.csp</groupId>-->
|
||||
<!--<artifactId>sentinel-datasource-nacos</artifactId>-->
|
||||
<!--</dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.csp</groupId>
|
||||
<artifactId>sentinel-datasource-nacos</artifactId>
|
||||
</dependency>
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>com.alibaba.csp</groupId>-->
|
||||
<!--<artifactId>sentinel-datasource-zookeeper</artifactId>-->
|
||||
|
@@ -9,11 +9,19 @@ management.health.diskspace.enabled=false
|
||||
|
||||
spring.cloud.sentinel.transport.dashboard=localhost:8080
|
||||
spring.cloud.sentinel.eager=true
|
||||
spring.cloud.sentinel.web-context-unify=true
|
||||
|
||||
#spring.cloud.sentinel.block-page=/errorPage
|
||||
#spring.cloud.sentinel.filter.enabled=false
|
||||
#spring.cloud.sentinel.http-method-specify=false
|
||||
|
||||
#spring.cloud.sentinel.datasource.ds6.nacos.server-addr=127.0.0.1:8848
|
||||
#spring.cloud.sentinel.datasource.ds6.nacos.username=nacos
|
||||
#spring.cloud.sentinel.datasource.ds6.nacos.password=nacos
|
||||
#spring.cloud.sentinel.datasource.ds6.nacos.dataId=flowrule.json
|
||||
#spring.cloud.sentinel.datasource.ds6.nacos.data-type=json
|
||||
#spring.cloud.sentinel.datasource.ds6.nacos.rule-type=flow
|
||||
|
||||
spring.cloud.sentinel.datasource.ds1.file.file=classpath: flowrule.json
|
||||
spring.cloud.sentinel.datasource.ds1.file.data-type=json
|
||||
spring.cloud.sentinel.datasource.ds1.file.rule-type=flow
|
||||
|
@@ -10,11 +10,13 @@
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
<artifactId>sentinel-dubbo-consumer-example</artifactId>
|
||||
<name>Spring Cloud Starter Alibaba Sentinel x Dubbo - Consumer Example</name>
|
||||
<description>Example demonstrating how to use sentinel with dubbo</description>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
@@ -30,7 +32,7 @@
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>sentinel-dubbo-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@@ -10,11 +10,13 @@
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
<artifactId>sentinel-dubbo-provider-example</artifactId>
|
||||
<name>Spring Cloud Starter Alibaba Sentinel x Dubbo - Provider Example</name>
|
||||
<description>Example demonstrating how to use sentinel with dubbo</description>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
@@ -30,7 +32,7 @@
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>sentinel-dubbo-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@@ -10,11 +10,13 @@
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
<artifactId>sentinel-feign-consumer-example</artifactId>
|
||||
<name>Spring Cloud Starter Alibaba Sentinel x Feign - Consumer Example</name>
|
||||
<description>Example demonstrating how to use sentinel with feign</description>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@@ -20,7 +20,6 @@ import com.alibaba.cloud.examples.service.EchoService;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2019-08-01
|
||||
* <p>
|
||||
* sentinel 降级处理
|
||||
*/
|
||||
@@ -35,7 +34,7 @@ public class EchoServiceFallback implements EchoService {
|
||||
/**
|
||||
* 调用服务提供方的输出接口.
|
||||
* @param str 用户输入
|
||||
* @return
|
||||
* @return String
|
||||
*/
|
||||
@Override
|
||||
public String echo(String str) {
|
||||
|
@@ -22,7 +22,6 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2019-08-01
|
||||
*/
|
||||
@Component
|
||||
public class EchoServiceFallbackFactory implements FallbackFactory<EchoServiceFallback> {
|
||||
|
@@ -24,7 +24,6 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2019-08-01
|
||||
* <p>
|
||||
* example feign client
|
||||
*/
|
||||
|
@@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2019-08-01
|
||||
*/
|
||||
@RestController
|
||||
public class EchoController {
|
||||
|
@@ -10,11 +10,13 @@
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
<artifactId>sentinel-webflux-example</artifactId>
|
||||
<name>Spring Cloud Starter Alibaba Sentinel x WebFlux Example</name>
|
||||
<description>Example demonstrating how to use sentinel with webflux</description>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
|
@@ -41,10 +41,10 @@ public class ZuulConfiguration {
|
||||
|
||||
@Override
|
||||
public BlockResponse fallbackResponse(String route, Throwable cause) {
|
||||
if (route.equals("my-service3")) {
|
||||
if ("my-service3".equals(route)) {
|
||||
return new BlockResponse(433, "Sentinel Block3", route);
|
||||
}
|
||||
else if (route.equals("my-service4")) {
|
||||
else if ("my-service4".equals(route)) {
|
||||
return new BlockResponse(444, "my-service4", route);
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user