可以利用锁定和里程碑 方法指针:def fun = stash。&merge println(fun()) def func(列出存储){for(def存储:存储){def fun =存储。&merge println(fun())}} def隐藏= [(new Stash(1))] func(stashes) 类Stash {def num Stash(num){this.num = num println(“ constructor”)} def merge() { return this.num } def getPrince() { return 'prince' } } @interface页面{int statusCode()默认200} @Page(statusCode = 404)void notFound(){println(statusCo