SpringProfileIfNestedWithinSecondPhaseElementSanityChecker Class — spring-boot Architecture
Architecture documentation for the SpringProfileIfNestedWithinSecondPhaseElementSanityChecker class in SpringProfileIfNestedWithinSecondPhaseElementSanityChecker.java from the spring-boot codebase.
Entity Profile
Source Code
core/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringProfileIfNestedWithinSecondPhaseElementSanityChecker.java lines 39–63
class SpringProfileIfNestedWithinSecondPhaseElementSanityChecker extends ContextAwareBase implements SanityChecker {
private static final List<Class<? extends Model>> SECOND_PHASE_TYPES = List.of(AppenderModel.class,
LoggerModel.class, RootLoggerModel.class);
@Override
public void check(@Nullable Model model) {
if (model == null) {
return;
}
List<Model> models = new ArrayList<>();
SECOND_PHASE_TYPES.forEach((type) -> deepFindAllModelsOfType(type, models, model));
List<Pair<Model, Model>> nestedPairs = deepFindNestedSubModelsOfType(SpringProfileModel.class, models);
if (!nestedPairs.isEmpty()) {
addWarn("<springProfile> elements cannot be nested within an <appender>, <logger> or <root> element");
nestedPairs.forEach((nested) -> {
Model first = nested.first;
Model second = nested.second;
addWarn("Element <%s> at line %s contains a nested <%s> element at line %s".formatted(first.getTag(),
first.getLineNumber(), second.getTag(), second.getLineNumber()));
});
}
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free