Spring loaded 实现热部署

在开发的时候修改某一项功能的时候老是需要重启,慢慢的就烦了。会追求更快速的开发避免这些操作。

例如热部署:不仅可以用户本地开发环境还可运用到服务器端虽然存在着一些风险但是还是非常方便的。

SPRING LOADED下载地址:https://github.com/spring-projects/spring-loaded#readme

链接中有一段:

What is Spring Loaded?

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.

Spring Loaded is usable on any bytecode that may run on a JVM, and is actually the reloading system used in Grails 2.

Spring Loaded 是一个JVM的代理,用于运行时的加载类进行一个更新和修改,Spring Loaded是先运行已经改变的Class然后在适当的时候进行一个重新加载过程。

Spring Loaded允许您添加/修改/删除方法/字段/构造函数。 类型/方法/字段/构造函数上的注释也可以修改,并且可以在枚举类型中添加/删除/更改值。

Spring Loaded可用于可能在JVM上运行的任何字节码,实际上是Grails 2中使用的重新加载系统。

现在先在开发环境中体验一把,在Tomcat运行参数添加:-javaagent:D:/apache-tomcat-8.0.39/lib/springloaded-1.2.5.RELEASE.jar -noverify

然后运行你的项目,例如我的在WEB项目中

然后修改

OK了

具体参考:http://blog.csdn.net/thc1987/article/details/50203149

posted @ 2017-06-03 10:57  小严  阅读(1330)  评论(0编辑  收藏  举报