黄色网址大全免费-黄色网址你懂得-黄色网址你懂的-黄色网址有那些-免费超爽视频-免费大片黄国产在线观看

專注Java教育14年 全國咨詢/投訴熱線:400-8080-105
動力節點LOGO圖
始于2009,口口相傳的Java黃埔軍校
首頁 hot資訊 Dubbo注解方式

Dubbo注解方式

更新時間:2021-09-07 11:47:15 來源:動力節點 瀏覽1679次

注解配置

服務提供方

Service注解暴露服務

import com.alibaba.dubbo.config.annotation.Service;
@Service(timeout = 5000)
public class AnnotateServiceImpl implements AnnotateService { 
    // ...
}

javaconfig形式配置公共模塊

@Configuration
public class DubboConfiguration {
    @Bean
    public ApplicationConfig applicationConfig() {
        ApplicationConfig applicationConfig = new ApplicationConfig();
        applicationConfig.setName("provider-test");
        return applicationConfig;
    }
    @Bean
    public RegistryConfig registryConfig() {
        RegistryConfig registryConfig = new RegistryConfig();
        registryConfig.setAddress("zookeeper://127.0.0.1:2181");
        registryConfig.setClient("curator");
        return registryConfig;
    }
}

指定dubbo掃描路徑

@SpringBootApplication
@DubboComponentScan(basePackages = "com.alibaba.dubbo.test.service.impl")
public class ProviderTestApp {
    // ...
}

服務消費方

Reference注解引用服務

public class AnnotationConsumeService {
    @com.alibaba.dubbo.config.annotation.Reference
    public AnnotateService annotateService;
    
    // ...
}

javaconfig形式配置公共模塊

@Configuration
public class DubboConfiguration {
    @Bean
    public ApplicationConfig applicationConfig() {
        ApplicationConfig applicationConfig = new ApplicationConfig();
        applicationConfig.setName("consumer-test");
        return applicationConfig;
    }
    @Bean
    public ConsumerConfig consumerConfig() {
        ConsumerConfig consumerConfig = new ConsumerConfig();
        consumerConfig.setTimeout(3000);
        return consumerConfig;
    }
    @Bean
    public RegistryConfig registryConfig() {
        RegistryConfig registryConfig = new RegistryConfig();
        registryConfig.setAddress("zookeeper://127.0.0.1:2181");
        registryConfig.setClient("curator");
        return registryConfig;
    }
}

指定dubbo掃描路徑

@SpringBootApplication
@DubboComponentScan(basePackages = "com.alibaba.dubbo.test.service")
public class ConsumerTestApp {
    // ...
}

以上就是動力節點小編介紹的"Dubbo注解方式",希望對大家有幫助,想了解更多可查看Dubbo教程。動力節點在線學習教程,針對沒有任何Java基礎的讀者學習,讓你從入門到精通,主要介紹了一些Java基礎的核心知識,讓同學們更好更方便的學習和了解Java編程,感興趣的同學可以關注一下。

提交申請后,顧問老師會電話與您溝通安排學習

免費課程推薦 >>
技術文檔推薦 >>
主站蜘蛛池模板: 强制高潮18xxxxhd日韩 | 看黄色特级片 | 十八成人网 | 免费一级毛片视频 | 天天干天天射天天爽 | 日日操干 | 夜夜拍拍 | 天天射天天草 | 麻豆md国产在线观看 | 日韩亚洲人成网站 | 最新日韩欧美不卡一二三区 | 真人一级一级特黄高清毛片 | 强制高潮18xxxxhd日韩 | 日韩版码免费福利视频 | 直接观看黄网站免费视频 | 日韩a级毛片免费观看 | 好男人在线社区www免费看 | 日韩在线视频在线 | 在线观看国产免费高清不卡 | 国产理伦 | 亚洲一区在线观看视频 | 欧美成视频在线观看 | 看全色黄大色大片免费视频 | 日韩欧美视频一区二区 | 一级黄网站| 精品国产_亚洲人成在线高清 | 午夜久久免影院欧洲 | 欧美有码在线观看 | 亚洲激情视频在线播放 | 黄色小视频免费网站 | 日日狠狠太爽爽 | 午夜片在线观看 | 免费人成视网站在线不卡 | 97色在线观看免费视频 | 国产一国产一级新婚之夜 | 日韩精品视频观看 | 国产第一区二区三区在线观看 | 久久久久夜色精品波多野结衣 | 一级毛片免费一级直接观看 | 午夜在线视频免费观看 | 国产欧美日韩不卡在线播放在线 |