异常

Caused by: java.lang.StackOverflowError
    at java.lang.reflect.Method.hashCode(Method.java:330) ~[?:1.8.0_65]
    at java.util.HashMap.hash(HashMap.java:338) ~[?:1.8.0_65]
    at java.util.HashMap.put(HashMap.java:611) ~[?:1.8.0_65]
    at java.util.HashSet.add(HashSet.java:219) ~[?:1.8.0_65]
    at org.springframework.core.annotation.AnnotatedElementUtils.searchWithFindSemantics(AnnotatedElementUtils.java:1119) ~[spring-core-4.3.0.RELEASE.jar:4.3.0.RELEASE]
    at org.springframework.core.annotation.AnnotatedElementUtils.searchWithFindSemantics(AnnotatedElementUtils.java:1183) ~[spring-core-4.3.0.RELEASE.jar:4.3.0.RELEASE]
    at org.springframework.core.annotation.AnnotatedElementUtils.searchWithFindSemantics(AnnotatedElementUtils.java:1208) ~[spring-core-4.3.0.RELEASE.jar:4.3.0.RELEASE]
    at org.springframework.core.annotation.AnnotatedElementUtils.searchWithFindSemantics(AnnotatedElementUtils.java:1086) ~[spring-core-4.3.0.RELEASE.jar:4.3.0.RELEASE]
    at org.springframework.core.annotation.AnnotatedElementUtils.searchWithFindSemantics(AnnotatedElementUtils.java:1060) ~[spring-core-4.3.0.RELEASE.jar:4.3.0.RELEASE]
    at org.springframework.core.annotation.AnnotatedElementUtils.findMergedAnnotationAttributes(AnnotatedElementUtils.java:656) ~[spring-core-4.3.0.RELEASE.jar:4.3.0.RELEASE]
    at org.springframework.core.annotation.AnnotatedElementUtils.findMergedAnnotation(AnnotatedElementUtils.java:730) ~[spring-core-4.3.0.RELEASE.jar:4.3.0.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:314) ~[spring-context-4.3.0.RELEASE.jar:4.3.0.RELEASE]
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$2cc24d5e.getHealthCheckRegistry(<generated>) ~[metrics-spring-3.1.3.jar:?]
    at com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerComposite.getHealthCheckRegistry(MetricsConfigurerComposite.java:68) ~[metrics-spring-3.1.3.jar:?]
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration.getHealthCheckRegistry(DelegatingMetricsConfiguration.java:69) ~[metrics-spring-3.1.3.jar:?]
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$2cc24d5e.CGLIB$getHealthCheckRegistry$3(<generated>) ~[metrics-spring-3.1.3.jar:?]
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$2cc24d5e$$FastClassBySpringCGLIB$$7853f663.invoke(<generated>) ~[metrics-spring-3.1.3.jar:?]
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.0.RELEASE.jar:4.3.0.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356) ~[spring-context-4.3.0.RELEASE.jar:4.3.0.RELEASE]
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$2cc24d5e.getHealthCheckRegistry(<generated>) ~[metrics-spring-3.1.3.jar:?]
    at com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerComposite.getHealthCheckRegistry(MetricsConfigurerComposite.java:68) ~[metrics-spring-3.1.3.jar:?]
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration.getHealthCheckRegistry(DelegatingMetricsConfiguration.java:69) ~[metrics-spring-3.1.3.jar:?]
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$2cc24d5e.CGLIB$getHealthCheckRegistry$3(<generated>) ~[metrics-spring-3.1.3.jar:?]
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$2cc24d5e$$FastClassBySpringCGLIB$$7853f663.invoke(<generated>) ~[metrics-spring-3.1.3.jar:?]
    [... repeat 100 times ...]
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.0.RELEASE.jar:4.3.0.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356) ~[spring-context-4.3.0.RELEASE.jar:4.3.0.RELEASE]
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$2cc24d5e.getHealthCheckRegistry(<generated>) ~[metrics-spring-3.1.3.jar:?]
    at com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerComposite.getHealthCheckRegistry(MetricsConfigurerComposite.java:68) ~[metrics-spring-3.1.3.jar:?]
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration.getHealthCheckRegistry(DelegatingMetricsConfiguration.java:69) ~[metrics-spring-3.1.3.jar:?]
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$2cc24d5e.CGLIB$getHealthCheckRegistry$3(<generated>) ~[metrics-spring-3.1.3.jar:?]
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$2cc24d5e$$FastClassBySpringCGLIB$$7853f663.invoke(<generated>) ~[metrics-spring-3.1.3.jar:?]

临时方案

  • 去掉@EnableMetrics

  • 增加如下配置

@Configuration
public class CustomDelegatingMetricsConfiguration extends DelegatingMetricsConfiguration {

    @Override
    @Autowired(required = false)
    public void setMetricsConfigurers(final List<MetricsConfigurer> configurers) {
    }
}

doc


codecraft
11.9k 声望2k 粉丝

当一个代码的工匠回首往事时,不因虚度年华而悔恨,也不因碌碌无为而羞愧,这样,当他老的时候,可以很自豪告诉世人,我曾经将代码注入生命去打造互联网的浪潮之巅,那是个很疯狂的时代,我在一波波的浪潮上留下...