Commit 026f47e
This PR cherry-picks changes from the original PR #24887 to branch 25.2.
---
#### Original PR description
> Class and annotation scanning at startup runs many passes (routes,
error handlers, web components, lookup, ...), each building a new
`ClassPathScanner`. Because `CustomResourceLoader` does not extend
`DefaultResourceLoader`, Spring's `CachingMetadataReaderFactory` falls
back to a per-scan cache bounded to 256 entries instead of the
application context's shared, unbounded resource cache. Parsed class
metadata is therefore discarded and re-computed on every pass, slowing
down startup on large classpaths.
>
> Keep the filtering `CustomResourceLoader` as the scanner's pattern
resolver so package and JAR filtering is preserved, and override the
scanner's `MetadataReaderFactory` with a single shared
`CachingMetadataReaderFactory` backed by the application context. As the
context is a `DefaultResourceLoader`, the factory now stores metadata in
the context's shared cache and reuses it across all scan passes.
>
> Fixes #24881
Co-authored-by: Marco Collovati <marco@vaadin.com>
1 parent 9fbe72f commit 026f47e
2 files changed
Lines changed: 58 additions & 1 deletion
File tree
- vaadin-spring/src
- main/java/com/vaadin/flow/spring
- test/java/com/vaadin/flow/spring
Lines changed: 31 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| |||
111 | 113 | | |
112 | 114 | | |
113 | 115 | | |
| 116 | + | |
114 | 117 | | |
115 | 118 | | |
116 | 119 | | |
| |||
166 | 169 | | |
167 | 170 | | |
168 | 171 | | |
| 172 | + | |
169 | 173 | | |
170 | 174 | | |
171 | 175 | | |
172 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
173 | 182 | | |
174 | 183 | | |
175 | 184 | | |
| |||
883 | 892 | | |
884 | 893 | | |
885 | 894 | | |
886 | | - | |
| 895 | + | |
| 896 | + | |
887 | 897 | | |
888 | 898 | | |
889 | 899 | | |
890 | 900 | | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
891 | 921 | | |
892 | 922 | | |
893 | 923 | | |
| |||
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| |||
248 | 251 | | |
249 | 252 | | |
250 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
251 | 278 | | |
252 | 279 | | |
253 | 280 | | |
| |||
0 commit comments