I am new to Spring.
This is the code for bean registration:
I think the answers proposed above to use constructor injection/setter injection doesn't work perfectly for the use case you are looking for. Spring more or less takes static argument values for constructors/setters. I don't see a way to dynamically pass values to get a Bean from Spring Container. However, if you want to get instances of User_Imple dynamically, I would recommend using a factory class User_Imple_Factory
public class User_Imple_factory {
private static ApplicationContext context =new ClassPathXmlApplicationContext("/bean.xml");
public User_Imple createUserImple(int id) {
User user = context.getBean("User");
return new User_Imple(id, user);
}
}