@ComponentScan
will give you a list of all the classes with the @Component
annotation in a package (or @Service
/@Repository
). To do this I imagine they use reflection to enumerate all the classes in a package and find the ones with that annotation.
However according to other StackOverflow answers you can not reliably enumerate all the classes in a package due to how the ClassLoader
works. So how does @ComponentScan
seemingly manage to accomplish this?
Aucun commentaire:
Enregistrer un commentaire