public MyClass1(ParentClass1 instance)
Now we have five child class which extends ParentClass1. Now in spring when are composing MyClass1 ,how we will determine which child instance out of five needs to be injected here (as it depends upon some runtime parameter depending on which we have to create child instance). Please help me here how we create the configuration file i.e spring-config.xml for above scenario(i mean is there any way to configure such type of scenarios in spring)?
This simple enough if you know how to create and define bean definition in your configuration file. Simply you just define all child class that you have and inject in the parent bean that you created with i.e "<constructor-arg ref="childClass1"/>".
From "MyClass1" you need to declare all child class reference variable and pass all ref variable in the constructor public MyClass1() similar what you already did.
Start from there and show us what you've done, I'll walk you through from there. Feel free post any question that you might have...
"Your life is in your hands, to make of it what you choose."