I want to fly higher
          programming Explorer
          posts - 114,comments - 263,trackbacks - 0
          <2015年6月>
          31123456
          78910111213
          14151617181920
          21222324252627
          2829301234
          567891011

          常用鏈接

          留言簿(5)

          隨筆分類(161)

          隨筆檔案(114)

          文章分類(2)

          文章檔案(2)

          Alibaba

          Comprehensive

          Expert

          Game

          Java

          搜索

          •  

          積分與排名

          • 積分 - 599965
          • 排名 - 78

          最新評論

          閱讀排行榜

          1.項(xiàng)目地址
              https://github.com/spring-projects/spring-loaded

          2.介紹
              Spring Loaded is a JVM agent for reloading class file changes whilst a JVM is running. It transforms classes at loadtime to make them amenable to later reloading. Unlike 'hot code replace' which only allows simple changes once a JVM is running (e.g. changes to method bodies), Spring Loaded allows you to add/modify/delete methods/fields/constructors. The annotations on types/methods/fields/constructors can also be modified and it is possible to add/remove/change values in enum types.

          3.小試牛刀
              1.下載spring-loaded:    
                  http://repo.spring.io/simple/libs-release-local/org/springframework/springloaded/1.2.3.RELEASE/springloaded-1.2.3.RELEASE.jar

              2.代碼示例(eclipse運(yùn)行)
          package com.mavsplus.example.springloaded;

          import java.util.concurrent.TimeUnit;

          /**
           * <a href="https://github.com/spring-projects/spring-loaded"></a>
           * 
           * @author landon
           * @since 1.8.0_25
           
          */
          public class SpringLoadedExample {

              public static void main(String[] args) throws Exception{
                  Reload reload = new Reload();

                  while (true) {
                      reload.load();
                      
                      TimeUnit.SECONDS.sleep(3);
                  }
              }

              public static class Reload {

                  public void load() {
                      System.out.println("load!");
                  }
              }
          }

              3.運(yùn)行配置VM arguments

              
                  PS:Maven工程,springloaded-1.2.3.RELEASE.jar放在了src/main/resources目錄

                  4.運(yùn)行:
                      程序每隔3s輸出load

                  5.直接修改load方法的輸出,輸出reload,直接保存即可,神奇的事情出現(xiàn),我們在未重啟application的情況下,進(jìn)行了代碼的reload

                      





          4.后續(xù)會結(jié)合源代碼以及更深層次的例子進(jìn)行剖析

          posted on 2015-06-19 14:35 landon 閱讀(5389) 評論(3)  編輯  收藏 所屬分類: JVMHotSwap

          FeedBack:
          # re: Spring-Loaded 使用Ⅰ-Getting Started
          2015-09-16 16:58 | cero
          我在項(xiàng)目中引入了springloaded之后,處理請求并返回就會報(bào)
          java.lang.String cannot be cast to org.springframework.http.MediaType
          這個錯 是為什么呢?  回復(fù)  更多評論
            
          # re: Spring-Loaded 使用Ⅰ-Getting Started
          2015-12-03 13:26 | ztr323
          按照上面的設(shè)置,為什么沒有反應(yīng)?代碼改變之后輸出還是原來的?  回復(fù)  更多評論
            
          # re: Spring-Loaded 使用Ⅰ-Getting Started
          2015-12-03 14:58 | ztr323
          原來部分jvm版本不行啊  回復(fù)  更多評論
            
          主站蜘蛛池模板: 阿拉善盟| 阳江市| 清丰县| 中宁县| 前郭尔| 措勤县| 怀集县| 福鼎市| 贵港市| 卓尼县| 赤城县| 城口县| 邯郸市| 肥乡县| 岳普湖县| 灌南县| 南丰县| 衡水市| 酒泉市| 北川| 延津县| 安乡县| 牙克石市| 敖汉旗| 靖西县| 搜索| 竹山县| 罗平县| 沁源县| 隆德县| 胶南市| 体育| 黄冈市| 凭祥市| 左贡县| 赤城县| 梅河口市| 龙岩市| 兰溪市| 大埔县| 兴宁市|