Home Annotation stop working after migration from grails 2.5.6 to 3.3
Reply: 0

Annotation stop working after migration from grails 2.5.6 to 3.3

user1538
1#
user1538 Published in April 19, 2018, 10:01 am

I have implemented some custom annotations. All of them were working before the migration to grails 3, but after we migrate the code, the applications throws nothing, everything is working but the annotations are just been ignored.

This is one of my @annotation:

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@interface UnoMetricsCounter {
    int increment() default 1
    String metricPrefix()
}

And my Aspect:

@Aspect
@Component
class UnoMetricsAspect {
    private static final log = LogFactory.getLog(getClass())
    SpringSecurityService springSecurityService

    @Before("@annotation( com.enterprise.annotation.UnoMetricsCounter)")
    void counterMetric(JoinPoint jp){
        String prefix = jp.getSignature().getMethod().getAnnotation(UnoMetricsCounter.class).metricPrefix()
        Long increment = (Long)jp.getSignature().getMethod().getAnnotation(UnoMetricsCounter.class).increment()

        log.info("IncrementCounterMetric has been called with prefix: "+prefix)
        MetricsUtils.incrementCounter(UnoMetricsUtils.addInfoToMetricName(UnoMetricsUtils."${prefix}", springSecurityService?.getCurrentUser()?.location?.name), UnoMetricsUtils.REGISTER_GRAPHITE_NAME,increment)
    }
...
}

I have another custom annotations with no aspect not working either.

I am not sure about what had happened because all the rest of not custom annotations works fine, I have found in google with no luck. Any ideas?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.346815 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO