groovy 动态执行script文档汇总
对于有些需求不用动态脚本来做就特别麻烦,故有了groovy之后,能在线写代码然后执行再修改这种感觉很好,之前有使用过groovy。这次再重新写个轮子来满足需求,特此将一些文档记录在此
?
?
Embedding Groovy (官方文档)http://groovy.codehaus.org/Embedding+Groovy
?
?
?
Groovy Goodness: Add Imports Transparently to Scripts with ImportCustomizer(一系列的关于groovy的tips)http://mrhaki.blogspot.com/2011/06/groovy-goodness-add-imports.html
?
?
对于实现自己的groovy动态脚本执行器的人要注意一点,需要将编译后的class或者scripe缓存起来防止每次都重新创建。
?
对于一些外部类引用需要使用全限定名的方式或者使用import功能,例如我上面第2个链接
1 楼 RednaxelaFX 2011-12-23 啊,这个ImportCustomizer不错。之前我只做过很弱的自动import:http://rednaxelafx.iteye.com/blog/891917 2 楼 dikar 2011-12-23 RednaxelaFX 写道啊,这个ImportCustomizer不错。之前我只做过很弱的自动import:http://rednaxelafx.iteye.com/blog/891917这么好的功能,之前不知道为啥没引入,mvel很早就支持了