Spring bean checking for classes
I want to scan all classes in a package that are subclasses of a certain class. Then I want to take these classes and for each one create a bean instance of the same type using the class as a property. Then I want to collect all these anonymous beans and put them in a collection. Is it possible to configure spring context in XML like this? thank
+2
source to share
4 answers
In Java, you cannot enumerate all the classes contained in a package without directly accessing the location where the class files are stored (usually the file system).
For the second part of your question, have a look at spring-list-beans-by-type .
0
source to share