Instantiating spring beans in dynamically created classes.
- by Xetius
I am dynamically creating classes which contain spring beans, however the beans are not getting instantiated or initialised, leaving them as null.
How do I make sure that a dynamically created class creates all of its spring beans properly?
This is how I am dynamically creating the class:
Class ctransform;
try {
    ctransform = Class.forName(strClassName);
    Method handleRequestMethod = findHandleRequestMethod(ctransform);
    if (handleRequestMethod != null) {
        return (Message<?>) handleRequestMethod.invoke(ctransform.newInstance(), message);
            }
    }
This leaves all spring bean objects within ctransform (of type strClassName) as null.