@Autowired No qualifying bean of type - Bean extending Abstract class
<p>I have a bean in package - data.dao</p>

<pre><code>@Component("questionDao")
@Transactional
public class QuestionDao extends AbstractDao&lt;Question, Long&gt;{

}
</code></pre>

<p>(all methods are implemented in AbstractDao)
I am writing testClass for this bean and I use autowiring like this:</p>

<pre><code>@Autowired
@Qualifier(value="questionDao")
private QuestionDao questionDao;
</code></pre>

<p>This way it works without any problem!</p>

<p>Now I need to add very specific method for QuestionDao bean so I've change it a little bit:</p>

<pre><code>@Component("questionDao")
@Transactional
public class QuestionDao extends AbstractDao&lt;Question, Long&gt;{
    public void doSomething(){
    }
}
</code></pre>

<p>As soon as I modify my bean (body is not empty) Autowiring doesnt work for some reason... "No qualifying bean of type data.dao.QuestionDao found for dependency. (I am using Spring 4.x)
Any ideas what can go wrong (In scenario 1 it works like charm but as soon as I touch QuestionDao class it fails to autowire)</p>

<p>Here's my AbstractDao class</p>

<pre><code>public class AbstractDao&lt;T, ID extends Serializable&gt; implements Dao&lt;T, ID&gt; {

    @Autowired
    protected SessionFactory sessionFactory;

    private Class&lt;T&gt; persistentClass;
    private Transaction transaction;

    @SuppressWarnings("unchecked")
    public AbstractDao() {
        this.persistentClass = (Class&lt;T&gt;) ((ParameterizedType) getClass().getGenericSuperclass())
                .getActualTypeArguments()[0];
    }

    protected Session getSession() {
        return sessionFactory.getCurrentSession();
    }

    public Class&lt;T&gt; getPersistentClass() {
        return persistentClass;
    }

    @SuppressWarnings("unchecked")
    @Override
    public T findById(ID id) {
        transaction = getSession().beginTransaction();

        T object = (T) getSession().load(this.getPersistentClass(), id);

        transaction.commit();

        return object;
    }

    @Override
    public List&lt;T&gt; findAll() {
        transaction = getSession().beginTransaction();

        List&lt;T&gt; list = this.findByCriteria();

        transaction.commit();

        return list;
    }

    @SuppressWarnings("unchecked")
    protected List&lt;T&gt; findByCriteria(Criterion... criterion) {
        Criteria crit = this.getSession().createCriteria(this.getPersistentClass());

        for (Criterion c : criterion) {
            crit.add(c);
        }
        return (List&lt;T&gt;) crit.list();
    }

    @Override
    public T create(T entity) {
        transaction = getSession().beginTransaction();

        getSession().saveOrUpdate(entity);

        transaction.commit();

        return entity;
    }

    @Override
    public void delete(T entity) {
        transaction = getSession().beginTransaction();

        getSession().delete(entity);

        transaction.commit();
    }

    @Override
    public void deleteTable() {
        transaction = getSession().beginTransaction();

        String deleteTable = new String ("delete " + this.getPersistentClass().getName());

        Query query = getSession().createQuery(deleteTable);
        query.executeUpdate();

        transaction.commit();
    }

}
</code></pre>

<p>Here's configuration for sessionFactory</p>

<pre><code>&lt;bean id="sessionFactory"
            class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
            &lt;property name="dataSource" ref="dataSource"&gt;&lt;/property&gt;
            &lt;property name="hibernateProperties"&gt;
                &lt;props&gt;
                    &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.PostgreSQL9Dialect&lt;/prop&gt;
                    &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
                &lt;/props&gt;
            &lt;/property&gt;
            &lt;property name="packagesToScan"&gt;
                &lt;list&gt;
                    &lt;value&gt;sk.uniza.fri.cuka.data.dao&lt;/value&gt;
                    &lt;value&gt;sk.uniza.fri.cuka.data.entity&lt;/value&gt;
                &lt;/list&gt;
            &lt;/property&gt;
        &lt;/bean&gt;
</code></pre>

<p>Full stackTrace:</p>

<pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sk.uniza.fri.cuka.test.tests.AnswerDaoTest': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private sk.uniza.fri.cuka.data.dao.QuestionDao sk.uniza.fri.cuka.test.tests.AnswerDaoTest.questionDao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [sk.uniza.fri.cuka.data.dao.QuestionDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.beans.factory.annotation.Qualifier(value=questionDao)}
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1210)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:385)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:212)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:200)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:259)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:261)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:219)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private sk.uniza.fri.cuka.data.dao.QuestionDao sk.uniza.fri.cuka.test.tests.AnswerDaoTest.questionDao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [sk.uniza.fri.cuka.data.dao.QuestionDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.beans.factory.annotation.Qualifier(value=questionDao)}
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
    ... 26 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [sk.uniza.fri.cuka.data.dao.QuestionDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.beans.factory.annotation.Qualifier(value=questionDao)}
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1301)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1047)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)
    ... 28 more
</code></pre>

<p>edit:
Problem solved: I just removed "@Transactional" and it works. I also refactor a little bit my QuestionDao so it implements interface as suggested Peter Jurkovic.   </p>