简体   繁体   English

获取@ Timedmetrics-spring的2个相同的拦截器AndDynamicMethodMatchers

[英]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 我正在使用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. 我使用@Timed批注,发现对于方法调用,interceptorsAndDynamicMethodMatchers中有两个TimedMethodInterceptor。 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. 如果我在Intellij IDEA中使用Jetty Runner运行相同的Web应用程序,则看不到问题。 Any clue? 有什么线索吗?

Just debugged a bit, there two BeanPostProcessors with Timed annotations. 只是调试了一下,就有两个带有Timed批注的BeanPostProcessor。 在此处输入图片说明

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. Tomcat解压缩war文件并在Catalinahome / webapps和Catalinahome / work目录中创建目录,从而导致了问题。 If I set unpackWARs attribute set to "false", the issue is gone. 如果我将unpackWARs属性设置为“ false”,则问题不再存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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