乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      springcloud(第二篇)springcloud config 修改配置

       WindySky 2017-07-17


      Git端修改配置后如何讓客戶端生效?

      訪問接口修改

      • refresh
        post方式執(zhí)行http://localhost/refresh 會刷新env中的配置
      • restart
        如果配置信息已經(jīng)注入到bean中,由于bean是單例的,不會去加載修改后的配置
        需要通過post方式去執(zhí)行http://localhost/restart,
        需要通過application.properties中配置endpoints.restart.enabled=true啟動指定的端口

      弊端: 通過restart耗時比較長,因此就有了RefreshScope

      RefreshScope

      package com.lkl.springcloud.config.client;
      
      import org.springframework.beans.factory.annotation.Value;
      import org.springframework.boot.SpringApplication;
      import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
      import org.springframework.cloud.context.config.annotation.RefreshScope;
      import org.springframework.context.annotation.ComponentScan;
      import org.springframework.web.bind.annotation.RequestMapping;
      import org.springframework.web.bind.annotation.RestController;
      
      /**
       * Created by liaokailin on 16/4/28.
       */
      @EnableAutoConfiguration
      @ComponentScan
      @RestController
      @RefreshScope
      public class Application {
      
          @Value("${name:World!}") String name ;
      
          @RequestMapping("/")
          public String home(){
              return "Hello " + name;
          }
      
      
          public static void main(String[] args) {
              SpringApplication.run(Application.class,args);
          }
      }

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多