-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@DubboService & @DubboReference 服务提供与消费
- Loading branch information
Showing
8 changed files
with
33 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
dubbo-consumer-sample/src/main/java/com/example/demo/controller/EchoController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.example.demo.controller; | ||
|
||
import com.example.demo.EchoService; | ||
import org.apache.dubbo.config.annotation.DubboReference; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
/** | ||
* Dubbo Spring Cloud 服务消费 | ||
* | ||
* @author yclimb | ||
* @date 2020/9/30 | ||
*/ | ||
@RestController | ||
public class EchoController { | ||
|
||
@DubboReference | ||
private EchoService echoService; | ||
|
||
@GetMapping("/echo") | ||
public String echo(String message) { | ||
return echoService.echo(message); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,13 +16,15 @@ | |
*/ | ||
package com.example.demo.nacosdiscovery; | ||
|
||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">theonefx</a> | ||
*/ | ||
@EnableDiscoveryClient | ||
@EnableAutoConfiguration | ||
@Configuration | ||
public class NacosDiscoveryConfiguration { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
dubbo-provider-sample/src/main/java/com/example/demo/service/SimpleEchoServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...n/java/com/alibaba/cloud/EchoService.java → ...in/java/com/example/demo/EchoService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.alibaba.cloud; | ||
package com.example.demo; | ||
|
||
/** | ||
* Dubbo 服务接口 | ||
|