This example uses triple as the underlying RPC protocol and IDL to define services. It's highly recommend to use triple and IDL for cross-language communication scenarios. Please refer to dubbo-samples-spring-boot for how to use pure Java interface to define services for triple protocol.
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-idl’ directory, run the following command:
$ mvn clean compile
Enter provider directory:
$ cd dubbo-samples-spring-boot-idl-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 '{"name":"Dubbo"}' \ http://localhost:50052/org.apache.dubbo.springboot.demo.idl.Greeter/greet/
Enter provider directory:
$ cd dubbo-samples-spring-boot-idl-consumer
then, run the following command to start consumer:
$ mvn compile exec:java -Dexec.mainClass="org.apache.dubbo.springboot.demo.consumer.ConsumerApplication"