Skip to content
Permalink
Browse files
modify groupID, packageName to org.apache.dubbo in README.md (#32)
  • Loading branch information
sicw authored and jerrick-zhu committed Oct 24, 2018
1 parent d0abb34 commit 7250210fc1944c3ddf0b2e664a07cb3c5e3dd9ab
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
@@ -6,13 +6,13 @@ First, there have to be an overall configuration of provider:

```Java
@Configuration
@EnableDubbo(scanBasePackages = "com.alibaba.dubbo.samples.impl")
@EnableDubbo(scanBasePackages = "org.apache.dubbo.samples.impl")
@PropertySource("classpath:/spring/dubbo-provider.properties")
static class ProviderConfiguration {
}
```

`@EnableDubbo` will enable Spring to scan `com.alibaba.dubbo.samples.impl` package to find anything annotated by Dubbo annotation.
`@EnableDubbo` will enable Spring to scan `org.apache.dubbo.samples.impl` package to find anything annotated by Dubbo annotation.

As a provider, the interface implementation class have to be annotated by `@Service`:

@@ -34,9 +34,9 @@ The overall configuration for consumer is very smilier to provider's:

```Java
@Configuration
@EnableDubbo(scanBasePackages = "com.alibaba.dubbo.samples.action")
@EnableDubbo(scanBasePackages = "org.apache.dubbo.samples.action")
@PropertySource("classpath:/spring/dubbo-consumer.properties")
@ComponentScan(value = {"com.alibaba.dubbo.samples.action"})
@ComponentScan(value = {"org.apache.dubbo.samples.action"})
static class ConsumerConfiguration {
}
@@ -11,11 +11,11 @@ mvn clean package
## Start the service provider

```bash
mvn -Djava.net.preferIPv4Stack=true -Dexec.mainClass=com.alibaba.dubbo.samples.provider.Application exec:java
mvn -Djava.net.preferIPv4Stack=true -Dexec.mainClass=org.apache.dubbo.samples.provider.Application exec:java
```

## Invoke the service consumer

```bash
mvn -Djava.net.preferIPv4Stack=true -Dexec.mainClass=com.alibaba.dubbo.samples.consumer.Application exec:java
mvn -Djava.net.preferIPv4Stack=true -Dexec.mainClass=org.apache.dubbo.samples.consumer.Application exec:java
```
@@ -56,5 +56,5 @@ Execute from another host or container
```sh
telnet 30.5.97.6 20881
ls
invoke com.alibaba.dubbo.test.docker.DemoService.hello("world")
invoke org.apache.dubbo.test.docker.DemoService.hello("world")
```
@@ -28,7 +28,7 @@ We can use two steps to export Rest Service in Dubbo:
Step 1: Add dependency to the pom file in our project:
```
<dependency>
<groupId>com.alibaba</groupId>
<groupId>org.apache</groupId>
<artifactId>dubbo-rpc-rest</artifactId>
<version>${dubbo.rpc.version}</version>
</dependency>
@@ -52,10 +52,10 @@ Step 2: copy these config to your spring config file:

```
<!-- SwaggerUI -->
<bean id="swaggerService" class="com.alibaba.dubbo.integration.swagger.DubboSwaggerApiListingResource" />
<bean id="swaggerService" class="org.apache.dubbo.integration.swagger.DubboSwaggerApiListingResource" />
<bean id="beanConfig" class="io.swagger.jaxrs.config.BeanConfig">
<property name="schemes" value="http" />
<property name="resourcePackage" value="com.alibaba.dubbo.samples.rest.api"/>
<property name="resourcePackage" value="org.apache.dubbo.samples.rest.api"/>
<property name="version" value="2.0"/>
<property name="host" value="localhost:8888"/>
<property name="basePath" value="/services/"/>
@@ -66,7 +66,7 @@ Step 2: copy these config to your spring config file:
<property name="licenseUrl" value="http://www.apache.org/licenses/LICENSE-2.0.html"/>
<property name="scan" value="true" />
</bean>
<dubbo:service interface="com.alibaba.dubbo.integration.swagger.DubboSwaggerService" ref="swaggerService" protocol="rest" />
<dubbo:service interface="org.apache.dubbo.integration.swagger.DubboSwaggerService" ref="swaggerService" protocol="rest" />
```

@@ -2,12 +2,12 @@

### Start Provider

Run `com.alibaba.dubbo.spring.boot.provider.ProviderApplication`
Run `org.apache.dubbo.spring.boot.provider.ProviderApplication`


### Start Consumer

Run `com.alibaba.dubbo.spring.boot.consumer.ConsumerApplication`
Run `org.apache.dubbo.spring.boot.consumer.ConsumerApplication`

### Result

@@ -2,12 +2,12 @@

### Start Provider

Run `com.alibaba.dubbo.samples.annotation.AnnotationProvider`
Run `org.apache.dubbo.samples.annotation.AnnotationProvider`


### Start Consumer

Run `com.alibaba.dubbo.samples.annotation.AnnotationConsumer`
Run `org.apache.dubbo.samples.annotation.AnnotationConsumer`

### Result

@@ -38,22 +38,22 @@ Start Zookeeper server:
zkServer start
```

Start `com.alibaba.dubbo.samples.service.hello.Application` in command line, you can also start it directly from IDE:
Start `org.apache.dubbo.samples.service.hello.Application` in command line, you can also start it directly from IDE:

```bash
mvn exec:java -Dexec.mainClass=com.alibaba.dubbo.samples.service.hello.Application
mvn exec:java -Dexec.mainClass=org.apache.dubbo.samples.service.hello.Application
```

Start `com.alibaba.dubbo.samples.service.greeting.Application` in command line, you can also start it directly from IDE:
Start `org.apache.dubbo.samples.service.greeting.Application` in command line, you can also start it directly from IDE:

```bash
mvn exec:java -Dexec.mainClass=com.alibaba.dubbo.samples.service.greeting.Application
mvn exec:java -Dexec.mainClass=org.apache.dubbo.samples.service.greeting.Application
```

Start client in command line, you can also start it directly from IDE:

```bash
mvn exec:java -Dexec.mainClass=com.alibaba.dubbo.samples.client.Application
mvn exec:java -Dexec.mainClass=org.apache.dubbo.samples.client.Application
```

"greeting, hello, world" should be print on the screen, then open http://localhost:9411 to check the trace. The sample trace in JSON format may look like this:

1 comment on commit 7250210

@diecui1202
Copy link
Contributor

@diecui1202 diecui1202 commented on 7250210 Oct 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sicw Now we need to transfer dubbo-samples to ASF, so all contributors need to sign ICLA. Please contact me ASAP via my email: diecui1202@gmail.com. Thanks

Please sign in to comment.