Hi,
I just had the same problem. I did not find a direct solution, but a I think I found a good work arround:
I implemented a BeanFactory, creating a class per Reflection. The class name can be set using a property. Of course, my simple implementation does only work with bean having no constructor parameter.
Code:
public class ReflectionFactory extends AbstractFactoryBean implements
FactoryBean {
private String className;
public void setClassName(String className) {
this.className = className;
}
protected Object createInstance() throws Exception {
return getObjectType().newInstance();
}
public Class getObjectType() {
try {
return Class.forName(className);
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Given Classname " + className
+ " not found.", e);
}
}
}
greetings
Robert