开发者

How does grails handle dynamic class reloading

开发者 https://www.devze.com 2023-02-17 01:59 出处:网络
How does开发者_高级运维 grails handle dynamic class reloading ?I did a little digging around, now this may not be perfect and will not include all the little details, however at a broad level I think

How does开发者_高级运维 grails handle dynamic class reloading ?


I did a little digging around, now this may not be perfect and will not include all the little details, however at a broad level I think this is what goes on:

  1. A thread is run say every X seconds, this thread detects if there have been any changes to Grails artifacts (domain,service,controller), custom artifacts can be included.
  2. If an artifact has been changed, then this bit of code is run which I think does the magic:

    GroovyClassLoader gcl = new GroovyClassLoader(application.getClassLoader()); initialisePlugin(gcl.parseClass(DefaultGroovyMethods.getText(conn.getInputStream())));

I got this by looking around DefaultGrailsPlugin which is part of grails core.

Everything in Grails is treated as a plugin even the service,domain,controllers and so on.


With a custom ClassLoader. Probably to vague a question and requires too in-depth of an answer for a site like SO. Might be better suited for the Grails mailing list.

0

精彩评论

暂无评论...
验证码 换一张
取 消