I have requirement where based on certain condition I need to invoke the different service classes. At the moment I have done this something like this. Below are the flow of events that occurs in which I am using reflection APIs to instantiate the required classes.Can I use spring over here. I have already used Spring's dependancy injection but this problem I can not adress with that much knowledge of spring.
Flow of events
1) Some action class querys the database to identify the no. of service classes to be invoked.
2) List of these service classes put in request.
3) Another POJO reads the list.
4) For each list item it reads the corresponding class name from a properties file.
e.g in propery file entry like
5) Instantiate this class using Java Reflection API
6) All these service classes implement a common interface having service() method.
7) call this service method to process the request.
As mentioned earlier, I am already using Dependancy Injetion in the Struts action classes and even in service classes.
What I am not confident about is the approach to instantiate these service classes using Reflection. Can I do that using spring as well.
P.S :- There are more than 50 service classes at the moment which can occur in any permutation and combination.