ConfigDataNotFoundFailureAnalyzer Class — spring-boot Architecture
Architecture documentation for the ConfigDataNotFoundFailureAnalyzer class in ConfigDataNotFoundFailureAnalyzer.java from the spring-boot codebase.
Entity Profile
Relationship Graph
Source Code
core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataNotFoundFailureAnalyzer.java lines 32–63
class ConfigDataNotFoundFailureAnalyzer extends AbstractFailureAnalyzer<ConfigDataNotFoundException> {
@Override
protected FailureAnalysis analyze(Throwable rootFailure, ConfigDataNotFoundException cause) {
ConfigDataLocation location = getLocation(cause);
Origin origin = Origin.from(location);
String message = String.format("Config data %s does not exist", cause.getReferenceDescription());
StringBuilder action = new StringBuilder("Check that the value ");
if (location != null) {
action.append(String.format("'%s' ", location));
}
if (origin != null) {
action.append(String.format("at %s ", origin));
}
action.append("is correct");
if (location != null && !location.isOptional()) {
action.append(String.format(", or prefix it with '%s'", ConfigDataLocation.OPTIONAL_PREFIX));
}
return new FailureAnalysis(message, action.toString(), cause);
}
private @Nullable ConfigDataLocation getLocation(ConfigDataNotFoundException cause) {
if (cause instanceof ConfigDataLocationNotFoundException locationNotFoundException) {
return locationNotFoundException.getLocation();
}
if (cause instanceof ConfigDataResourceNotFoundException resourceNotFoundException) {
return resourceNotFoundException.getLocation();
}
return null;
}
}
Domain
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free