Skip to content

Log warning when meta-annotation is ignored due to types not present in classpath #35927

@dsyer

Description

@dsyer

@ConditionalOnClass is a Spring Boot feature but it relies on the fact that the ConditionEvaluator in Framework can read the metadata from it without having to load the classes it refers to. With the ASM use case, we use a MergedAnnotationsCollection. Which uses AnnotationTypeMappings which delegates to AnnotationsScanner.getDeclaredAnnotations(), and that ends up swallowing the exception and removes the @ConditionalOnClass(X.class) annotation from the mappings, because the X type cannot be loaded.

The code that filters out @ConditionalOnClass is actually in AttributeMethods.canLoad() - this method returns "false" when the type to be tested is not present.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions