This example shows how to use Dubbo Spring Boot Starter to develop Dubbo application. For the underlying RPC protocol, we are using triple and at the same time, we use java interface as the way to define service. It‘s a more convenient way to develop Dubbo application if there’s no cross-language communication requirement.
Please refer to
This example replies on Nacos as service discovery registry center, so you need to run the Nacos server first, there are two ways to do so:
Step into ‘dubbo-samples-spring-boot’ directory, run the following command:
$ mvn clean install
Enter provider directory:
$ cd dubbo-samples-spring-boot-provider
then, run the following command to start provider:
$ mvn compile exec:java -Dexec.mainClass="org.apache.dubbo.springboot.demo.provider.ProviderApplication"
Run the following command to see server works as expected:
curl \ --header "Content-Type: application/json" \ --data '["Dubbo"]' \ http://localhost:50052/org.apache.dubbo.springboot.demo.DemoService/sayHello/
Enter provider directory:
$ cd dubbo-samples-spring-boot-consumer
then, run the following command to start consumer:
$ mvn compile exec:java -Dexec.mainClass="org.apache.dubbo.springboot.demo.consumer.ConsumerApplication"