Avoid SourceClass creation for annotations that are always ignored #22750
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
In a small Spring Boot app,
ConfigurationClassParser$SourceClass.getAnnotations()
creates 200SourceClass
instances each for@Target
,@Retention
, and@Documented
. They are then skipped as they're in ajava.*
package:spring-framework/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java
Lines 531 to 543 in 898494a
It doesn't take long (a handful of milliseconds), but I still think it would be worth avoiding the unnecessary time that's spent and the unnecessary garbage that's created by changing
SourceClass.getAnnotations()
to only createSourceClass
instances for annotations that are then processed.The text was updated successfully, but these errors were encountered: