I have an application that is based on webservices in which multiple classes are present. Some classes types are abstract
that is extended in other classes for defining the body to the abstract class methods. I used spring for instantiate the classes in spring context xml. I have used context:component-scan base-package="com.test.webservices"
it scan all the @Component
class and instantiated but it will not scan the abstract class.
Now My question here is that is there any solution for scanning abstract class using component-scan ?
Code is like-
@Component
public abstract class HibernateEntityManager{ ... }
@Component
public class HibernateGenericDaoImpl extends HibernateEntityManager{ ... }
In applicationContext.xml I have
<context:component-scan base-package="com.test.webservices"/>
that scan all classes excepts abstract classes.
Exception is :-
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManager' defined in ServletContext resource [/WEB-INF/classes/ApplicationContext/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.test.webservices.utils.HibernateEntityManager]: Is it an abstract class?; nested exception is java.lang.InstantiationException