Broaden caught exceptions (#1985)

Handle BeanCreationException instead of just BeanCurrentlyInCreationException.

This handles the case when a cyclic reference (causing a BeanCurrentlyInCreationException) occurs further down the line - when it is not the actuator of that references the in-creation HttpTracing bean, but a dependency of that actuator. In this case the exception that bubbles up here is an UnsatisfiedDependencyException, which is a BeanCreationException
This commit is contained in:
Andrew Flower
2021-06-25 00:42:53 +09:00
committed by GitHub
parent b876551a78
commit 08b4c1368e

View File

@@ -23,7 +23,7 @@ import java.util.StringJoiner;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.springframework.beans.factory.BeanCurrentlyInCreationException;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties;
import org.springframework.boot.actuate.autoconfigure.web.server.ConditionalOnManagementPort;
@@ -83,7 +83,7 @@ class SkipPatternConfiguration {
}
return () -> result;
}
catch (BeanCurrentlyInCreationException e) {
catch (BeanCreationException e) {
// Most likely, there is an actuator endpoint that indirectly references an
// instrumented HTTP client.
return () -> consolidateSkipPatterns(patterns);