简体   繁体   中英

get the 2 identical interceptorsAndDynamicMethodMatchers for @Timed metrics-spring

I am using Spring 4.2.5, Jersey 2.22.2, Tomcat 8.0, io.dropwizard.metrics 3.1.2, metrics-spring 3.1.2

I am using @Timed annotation and found that for the method invocation, there are two TimedMethodInterceptor in the interceptorsAndDynamicMethodMatchers. It ends up the count doubles the real method invocation.

If I run the same webapp using Jetty Runner in Intellij IDEA, I don't see the problem. Any clue?

Just debugged a bit, there two BeanPostProcessors with Timed annotations. 在此处输入图片说明

I finally figured out what caused it. Tomcat unpack the war file and create directory in both Catalinahome/webapps and Catalinahome/work directory which somehow caused the issue. If I set unpackWARs attribute set to "false", the issue is gone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM