javamelody / grails-melody-plugin

JavaMelody monitoring plugin for Grails, to monitor application performance
https://plugins.grails.org/plugin/grails-melody-plugin
Apache License 2.0
32 stars 31 forks source link

Add back enabling expando globally #64

Closed bassmartin closed 6 years ago

bassmartin commented 6 years ago

to properly support subclassing of services and other stuff. This makes intercepting all service calls work as they were a while ago. The code is done in the doWithSpring phase to avoid removing metaclass changes done by Grails (see #43)

Fixes #63

bassmartin commented 6 years ago

I got an issue in staging with this fix, I'll investigate tomorrow. Do not merge yet.

bassmartin commented 6 years ago

The issue was loosely related to ExpandoMetaclass being enabled globally. I had to replace one as to a regular Java cast () in a @Singleton class.

I just pushed another change to put this 'enable' in a static block instead of in the doWithSpring block so it is executed sooner during application boot.

sergiomichels commented 6 years ago

How about Graeme's comment that this shouldn't be used with Grails 3.x? With this revert we will not get the original issue back?

bassmartin commented 6 years ago

I'm enabling it in a static block, so before metaclass changes are done by Grails so I think it goes around the issue (previously we were enabling it late in the bootstrap, after some metaclass changes done by Grails, which was causing issue). Maybe Grails do not requires the global expando, but the plugins does to properly monitor beans. There might be another way to do it that I'm not aware of though.