I'm trying to instantiate a bean, without a class definition, on Spring context by inheriting a parent bean, which is abstract. Like this:
<bean id="childBean" parent="abstractBean">
<bean id="abstractBean" class="com.java.bean.AbstractBeanClass"
Error creating bean with name 'childBean' defined in class path resource
Instantiation of bean failed; nested exception is
Could not instantiate bean class [com.java.bean.AbstractBeanClass]:
Is it an abstract class?;
nested exception is java.lang.InstantiationException
<bean id="variantOptionDataConverter" parent="abstractPopulatingConverter">
public abstract class AbstractBeanClass<SOURCE, TARGET>
extends AbstractConverter<SOURCE, TARGET>
implements PopulatorList<SOURCE, TARGET>
Found the answer:
Indeed, like Sotirios Delimanolis commented, "You must have something else going on, proxying of some kind maybe", Spring has a proxy that instantiate this type of bean declaration, but it can't instantiate the bean without its methods (which are just declared in the abstract class, not implemented).
So you must "implement" these methods, like this:
<bean id="childBean" parent="abstractBean"> <lookup-method name="notImplementedMethod" bean="anotherBean"/> </bean>
The anotherBean must be the same type as notImplementedMethod.