mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
polish #761 update pkg name & maven coordinate for Greenwich
This commit is contained in:
@@ -50,7 +50,7 @@ Provider端在application.properties文件中定义dubbo相关的配置,比如
|
||||
|
||||
foo.service.version = 1.0.0
|
||||
|
||||
dubbo.scan.basePackages = org.springframework.cloud.alibaba.cloud.examples
|
||||
dubbo.scan.basePackages = com.alibaba.cloud.examples
|
||||
|
||||
dubbo.application.id = dubbo-provider-demo
|
||||
dubbo.application.name = dubbo-provider-demo
|
||||
@@ -66,7 +66,7 @@ Provider端在application.properties文件中定义dubbo相关的配置,比如
|
||||
|
||||
`sentinel-dubbo-api`模块中定义了FooService服务,内容如下:
|
||||
|
||||
package org.springframework.cloud.alibaba.cloud.examples.FooService;
|
||||
package FooService;
|
||||
public interface FooService {
|
||||
String hello(String name);
|
||||
}
|
||||
@@ -93,17 +93,17 @@ Consumer端在服务调用之前,先定义限流规则。
|
||||
|
||||
`sentinel-dubbo-api`模块中定义了FooService服务,内容如下:
|
||||
|
||||
package org.springframework.cloud.alibaba.cloud.examples.FooService;
|
||||
package FooService;
|
||||
public interface FooService {
|
||||
String hello(String name);
|
||||
}
|
||||
|
||||
该服务在Sentinel下对应的资源名是 `org.springframework.cloud.alibaba.cloud.examples.dubbo.FooService:hello(java.lang.String)` 。
|
||||
该服务在Sentinel下对应的资源名是 `com.alibaba.cloud.examples.FooService:hello(java.lang.String)` 。
|
||||
|
||||
定义该资源名对应的限流规则:
|
||||
|
||||
FlowRule flowRule = new FlowRule();
|
||||
flowRule.setResource("org.springframework.cloud.alibaba.cloud.examples.dubbo.FooService:hello(java.lang.String)");
|
||||
flowRule.setResource("com.alibaba.cloud.examples.FooService:hello(java.lang.String)");
|
||||
flowRule.setCount(10);
|
||||
flowRule.setGrade(RuleConstant.FLOW_GRADE_QPS);
|
||||
flowRule.setLimitApp("default");
|
||||
|
@@ -18,7 +18,7 @@ Before we start the demo, let's learn how to connect Sentinel with Dubbo to a Sp
|
||||
1. Add dependency spring-cloud-starter-alibaba-sentinel and dubbo-spring-boot-starter in the pom.xml file in your Spring Cloud project.
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
@@ -48,7 +48,7 @@ Define some configs of dubbo in `application.properties` in provider side, like
|
||||
|
||||
foo.service.version = 1.0.0
|
||||
|
||||
dubbo.scan.basePackages = org.springframework.cloud.alibaba.cloud.examples
|
||||
dubbo.scan.basePackages = com.alibaba.cloud.examples
|
||||
|
||||
dubbo.application.id = dubbo-provider-demo
|
||||
dubbo.application.name = dubbo-provider-demo
|
||||
@@ -64,7 +64,7 @@ Define some configs of dubbo in `application.properties` in provider side, like
|
||||
|
||||
`sentinel-dubbo-api` define a service named FooService:
|
||||
|
||||
package org.springframework.cloud.alibaba.cloud.examples.FooService;
|
||||
package FooService;
|
||||
public interface FooService {
|
||||
String hello(String name);
|
||||
}
|
||||
@@ -91,17 +91,17 @@ We will configure flow control rules before service invocation in consumer side.
|
||||
|
||||
`sentinel-dubbo-api` define a service named FooService:
|
||||
|
||||
package org.springframework.cloud.alibaba.cloud.examples.FooService;
|
||||
package FooService;
|
||||
public interface FooService {
|
||||
String hello(String name);
|
||||
}
|
||||
|
||||
The resource name of this service's `hello` method is `org.springframework.cloud.alibaba.cloud.examples.dubbo.FooService:hello(java.lang.String)` .
|
||||
The resource name of this service's `hello` method is `com.alibaba.cloud.examples.FooService:hello(java.lang.String)` .
|
||||
|
||||
Configure rules:
|
||||
|
||||
FlowRule flowRule = new FlowRule();
|
||||
flowRule.setResource("org.springframework.cloud.alibaba.cloud.examples.dubbo.FooService:hello(java.lang.String)");
|
||||
flowRule.setResource("com.alibaba.cloud.examples.FooService:hello(java.lang.String)");
|
||||
flowRule.setCount(10);
|
||||
flowRule.setGrade(RuleConstant.FLOW_GRADE_QPS);
|
||||
flowRule.setLimitApp("default");
|
||||
|
@@ -3,14 +3,14 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-examples</artifactId>
|
||||
<version>0.9.1.BUILD-SNAPSHOT</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>sentinel-dubbo-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<description>api for sentinel dubbo example</description>
|
||||
|
@@ -0,0 +1,10 @@
|
||||
package com.alibaba.cloud.examples;
|
||||
|
||||
/**
|
||||
* @author fangjian
|
||||
*/
|
||||
public interface FooService {
|
||||
|
||||
String hello(String name);
|
||||
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
package org.springframework.cloud.alibaba.cloud.examples;
|
||||
|
||||
/**
|
||||
* @author fangjian
|
||||
*/
|
||||
public interface FooService {
|
||||
|
||||
String hello(String name);
|
||||
|
||||
}
|
@@ -3,7 +3,7 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-examples</artifactId>
|
||||
<version>0.9.1.BUILD-SNAPSHOT</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
@@ -18,12 +18,12 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>sentinel-dubbo-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package org.springframework.cloud.alibaba.cloud.examples;
|
||||
package com.alibaba.cloud.examples;
|
||||
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package org.springframework.cloud.alibaba.cloud.examples;
|
||||
package com.alibaba.cloud.examples;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@@ -16,7 +16,7 @@ import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;
|
||||
/**
|
||||
* @author fangjian
|
||||
*/
|
||||
@SpringBootApplication(scanBasePackages = "org.springframework.cloud.alibaba.cloud.examples")
|
||||
@SpringBootApplication(scanBasePackages = "com.alibaba.cloud.examples")
|
||||
public class SentinelDubboConsumerApp {
|
||||
|
||||
@Bean
|
||||
@@ -27,8 +27,7 @@ public class SentinelDubboConsumerApp {
|
||||
public static void main(String[] args) {
|
||||
|
||||
FlowRule flowRule = new FlowRule();
|
||||
flowRule.setResource(
|
||||
"org.springframework.cloud.alibaba.cloud.examples.FooService:hello(java.lang.String)");
|
||||
flowRule.setResource("com.alibaba.cloud.examples.FooService:hello(java.lang.String)");
|
||||
flowRule.setCount(10);
|
||||
flowRule.setGrade(RuleConstant.FLOW_GRADE_QPS);
|
||||
flowRule.setLimitApp("default");
|
@@ -3,7 +3,7 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-examples</artifactId>
|
||||
<version>0.9.1.BUILD-SNAPSHOT</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
@@ -18,12 +18,12 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>sentinel-dubbo-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package org.springframework.cloud.alibaba.cloud.examples;
|
||||
package com.alibaba.cloud.examples;
|
||||
|
||||
import org.apache.dubbo.config.annotation.Service;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package org.springframework.cloud.alibaba.cloud.examples;
|
||||
package com.alibaba.cloud.examples;
|
||||
|
||||
import org.springframework.boot.WebApplicationType;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
@@ -2,7 +2,7 @@ spring.application.name = dubbo-provider-demo
|
||||
|
||||
foo.service.version = 1.0.0
|
||||
|
||||
dubbo.scan.basePackages = org.springframework.cloud.alibaba.cloud.examples
|
||||
dubbo.scan.basePackages = com.alibaba.cloud.examples
|
||||
|
||||
dubbo.application.id = dubbo-provider-demo
|
||||
dubbo.application.name = dubbo-provider-demo
|
||||
|
Reference in New Issue
Block a user