@Reference 用在消费端,表明使用的是服务端的什么服务@RestController
public class RemoteUserController {

@Reference(version = "1.0.0",check = true)
    private RemoteUserService remoteUserService;

@RequestMapping(value="/dubbo/say/{name}")
    public String sayHello(@PathVariable("name") String name){
        //调用服务提供者的服务
        String result=remoteUserService.sayHello(name);
        return result;
    }
}

@Service 用在服务提供者中,在类或者接口中声明。
服务提供者实现相关的服务接口,当消费端调用相关的类时,最终会调用提供者的实现方法。
@Component
@Service(version = "1.0.0",timeout = 10000,interfaceClass = RemoteUserService.class)
public class RemoteUserServiceImpl implements RemoteUserService {     @Override
    public String sayHello(String name) {         log.info("访问sayHello " + name);
        return "Hello " + name;
    }
}

Dubbo的@Reference和@Service说明---1Reference用在消费者2Service用在提供者【import com.alibaba.dubbo.config.annotation.Service;】的更多相关文章

  1. org.springframework.stereotype.Service和com.alibaba.dubbo.config.annotation.Service两种service的区别

    这两个Service,都可以在service类头上使用@Service的注解,于是我就写错了,查了半天才发现.他们的区别大概是这个样子的: org.springframework.stereotype ...

  2. dubbo在idea下的使用创建 服务者,消费者 注册中心

    1.基于windows 下  spring 下的dubbo  需要书写配置文件 (1).创建带有web工程的项目 创建一个服务者 package cn.edu.aynu.bean; import lo ...

  3. dubbo No provider available for the service com.alibaba.dubbo.monitor.MonitorService from registry

    No provider available for the service com.alibaba.dubbo.monitor.MonitorService from registry http:// ...

  4. com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method findUserByUserNo in the service wusc.edu.facade.user.service.PmsUserFacade.

    017-04-25 10:55:30,505 INFO [AbstractRegistry.java:302] : [DUBBO] Register: consumer://192.168.1.101 ...

  5. com.alibaba.dubbo.rpc.RpcException: Failed to invoke remote method解决方法

    报错日记: Caused by: com.alibaba.dubbo.rpc.RpcException: Failed to invoke remote method: getUserAuthLeve ...

  6. dubbo的消费者是怎么获取提供者服务接口引用的?

    本文主要解读dubbo消费者是如何引用服务端接口的,是如何像本地调用一样调用远程服务的. 并试着从设计者的角度思考,为何这样设计. @Component public class DubboConsu ...

  7. com.alibaba.dubbo.rpc.RpcException: Fail to start server(url: dubbo://192.16。。

    开启了linux的zookeeper服务,启动e3-manager时发现出现com.alibaba.dubbo.rpc.RpcException: Fail to start server(url: ...

  8. com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method

    查看了网友们的错误原因, 需要进行实例化的类没有进行实例化,具体没有实例化的类会在错误信息中显示,在错误信息中搜索“Serializable”即可找到将其实现序列化可消除错误. 是在使用Dubbo提供 ...

  9. [TODO]com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method

    异常信息如下: 2018-10-30 20:00:50.230 ERROR java.util.concurrent.ExecutionException: com.alibaba.dubbo.rpc ...

随机推荐

  1. enote笔记语言(5)——其他

    章节:其他   ((主:单词))                               用来醒目地强调这个句子中哪个词语作主语 sentence:                         ...

  2. 使用 Cordova 打包 app

    1.安装nodejs 2.安装 cordova npm install -g cordova 3.Cordova 打包成安卓APK需要用到ANT打包工具,首先配置好java环境: 下载安装Java J ...

  3. Scrapy——6 APP抓包—scrapy框架下载图片

    Scrapy——6 怎样进行APP抓包 scrapy框架抓取APP豆果美食数据 怎样用scrapy框架下载图片 怎样用scrapy框架去下载斗鱼APP的图片? Scrapy创建下载图片常见那些问题 怎 ...

  4. 剖析Spark-Shell

    打开spark-shell,我们可以看到 function main() { if $cygwin; then stty -icanon min 1 -echo > /dev/null 2> ...

  5. 清北学堂模拟赛d3t6 c

    分析:比较神奇的一道题.要把树变成环肯定要先变成链,然后把链给拼接成环.接下来考虑一个脑洞大开的树形dp:设f[i][0]表示i不与父节点相连的链数,f[i][1]表示i与父节点相连的链数,先考虑怎么 ...

  6. N天学习一个linux命令之kill

    用途 用于终止进程 用法 kill [-s signal|-p] [--] pid... kill -l [signal] 说明 1.默认发送信号15(请求终止进程,程序可以捕获,操作系统会杀死没有对 ...

  7. MVC.Net: jqueryval错误

    当使用Mvc.net创建Create表单后,firebug Create页面会出现404 Not Found - http://192.168.3.95:7001/bundles/jqueryval& ...

  8. Two Heads Are Often Better Than One

    Two Heads Are Often Better Than One Adrian Wible PROGRAMMING REQUIRES DEEP THOUGHT, and deep thought ...

  9. NGINX之——配置HTTPS加密反向代理訪问–自签CA

    转载请注明出处:http://blog.csdn.net/l1028386804/article/details/46695495 出于公司内部訪问考虑,採用的CA是本机Openssl自签名生成的,因 ...

  10. [Jest] Write data driven tests in Jest with test.each

    Often, we end up creating multiple unit tests for the same unit of code to make sure it behaves as e ...