Grails AOP with aspectj and / or Groovy AOP, preferably using annotations

In our corporate application, we would like to pose problems with cross-sections, such as logging, metrization as aspects. We already have some ready-made aspect tips (from our existing java application), but I don’t find a way to integrate aspectj with Grails.

I already know beforeInterceptor and afterInterceptor , but this needs to be done in all controllers and services, is there an easier way to do this.

My preferred approach would be to create annotations like @Metrics for any method in my grails application, and it should get some recommendations. Someone did this, any links / resources / examples would be nice.

+4
source share
1 answer

Maybe you can take a look at Grails filters that you can use for cross-cutting tasks such as logging, etc.: http://grails.org/doc/2.1.0/ref/Plug-ins/filters.html

Regarding the use of annotations, perhaps this article may be useful, but I have not tested it: http://manbuildswebsite.com/2010/03/15/simple-aspects-using-annotations-in-grails/

Good luck.

+4
source

Source: https://habr.com/ru/post/1436486/


All Articles