1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時(shí)間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      [Springcloud一步步實(shí)現(xiàn)廣告系統(tǒng)]10.使用Ribbon實(shí)現(xiàn)微服務(wù)調(diào)用

      在使用Ribbon調(diào)用廣告投放系統(tǒng)API之前,我們需要先創(chuàng)建2個(gè)VO對(duì)象,AdPlanVO,AdPlanGetRequestVO.

      灣里網(wǎng)站制作公司哪家好,找成都創(chuàng)新互聯(lián)公司!從網(wǎng)頁設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、成都響應(yīng)式網(wǎng)站建設(shè)等網(wǎng)站項(xiàng)目制作,到程序開發(fā),運(yùn)營維護(hù)。成都創(chuàng)新互聯(lián)公司2013年開創(chuàng)至今到現(xiàn)在10年的時(shí)間,我們擁有了豐富的建站經(jīng)驗(yàn)和運(yùn)維經(jīng)驗(yàn),來保證我們的工作的順利進(jìn)行。專注于網(wǎng)站建設(shè)就選成都創(chuàng)新互聯(lián)公司

      //數(shù)據(jù)請(qǐng)求對(duì)象
      @Data
      @NoArgsConstructor
      @AllArgsConstructor
      public class AdPlanGetRequestVO {
          private Long userId;
          private List planIds;
      }
      
      ----------------------------------
      
      //API請(qǐng)求響應(yīng)結(jié)果反序列化對(duì)象
      @Data
      @AllArgsConstructor
      @NoArgsConstructor
      public class AdPlanVO {
          private Long planId;
          private Long userId;
          private String planName;
          private Integer planStatus;
          private Date startDate;
          private Date endDate;
          private Date createTime;
          private Date updateTime;
      }

      AdSearchApplication啟動(dòng)類中,添加RestTemplate客戶端。

      public class AdSearchApplication {
        ...
          /**
           * 注冊(cè){@link RestTemplate}Bean
           * @return
           */
          @Bean
          @LoadBalanced //讓RestTemplate在調(diào)用服務(wù)的時(shí)候,可以實(shí)現(xiàn)負(fù)載均衡
          RestTemplate restTemplate(){
              return new RestTemplate();
          }
      }

      創(chuàng)建一個(gè)controller,來測(cè)試調(diào)用廣告提供系統(tǒng)的API

      /**
       * SearchController for search information controller
       *
       * @author Isaac.Zhang | 若初
       */
      @RestController
      @Slf4j
      @RequestMapping(path = "/search")
      public class SearchController {
          //注入RestTemplate
          private final RestTemplate restTemplate;
          @Autowired
          public SearchController(RestTemplate restTemplate) {
              this.restTemplate = restTemplate;
          }
      
          @GetMapping(path = "/plan/get-ribbon")
          public CommonResponse> getAdPlansUseRibbon(@RequestBody AdPlanGetRequestVO requestVO) {
              log.info("ad-search::getAdPlansUseRibbon -> {}", JSON.toJSONString(requestVO));
              return restTemplate.postForEntity(
                      "http://mscx-ad-sponsor/ad-sponsor/plan/get", requestVO, CommonResponse.class
              ).getBody();
          }
      
          @GetMapping(path = "/user/get")
          public CommonResponse getUsers(@Param(value = "username") String username) {
              log.info("ad-search::getUsers -> {}", JSON.toJSONString(username));
              CommonResponse commonResponse = restTemplate.getForObject(
                      "http://mscx-ad-sponsor/ad-sponsor/user/get?username={username}", CommonResponse.class, username
              );
              return commonResponse;
          }
      }

      網(wǎng)站題目:[Springcloud一步步實(shí)現(xiàn)廣告系統(tǒng)]10.使用Ribbon實(shí)現(xiàn)微服務(wù)調(diào)用
      網(wǎng)站網(wǎng)址:http://www.ef60e0e.cn/article/psppdd.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        稻城县| 新蔡县| 任丘市| 绥芬河市| 陆河县| 黑河市| 长海县| 池州市| 宁强县| 三亚市| 榆中县| 昆明市| 应城市| 赣州市| 库车县| 思南县| 锦州市| 玉溪市| 伊通| 怀来县| 大城县| 兴安盟| 稻城县| 定州市| 丹寨县| 永年县| 双牌县| 宁海县| 黎城县| 平和县| 博客| 芜湖县| 新兴县| 比如县| 长岭县| 内黄县| 高青县| 华安县| 新丰县| 重庆市| 固原市|