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://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>

        湾仔区| 汨罗市| 新宁县| 普陀区| 阿勒泰市| 比如县| 房山区| 宁武县| 特克斯县| 天等县| 宝山区| 祥云县| 阜阳市| 渭源县| 涞源县| 长春市| 霍林郭勒市| 泾源县| 柳江县| 天等县| 石城县| 堆龙德庆县| 油尖旺区| 千阳县| 青田县| 桃江县| 罗甸县| 石泉县| 高要市| 塔河县| 卓资县| 中卫市| 枣庄市| 望都县| 清流县| 和龙市| 麻江县| 子长县| 琼结县| 香河县| 莱西市|