annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
<p>When I run this code it was shows this kind of error:</p>

<blockquote>
  <p>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roomController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.Room.Dao.RoomDao com.Room.Controller.RoomController.roomDao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.Room.Dao.RoomDao] 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)}</p>
</blockquote>

<p>How can I solve this error?</p>

<p>Controller:</p>

<pre><code>@RestController
@RequestMapping("/service/user/")
public class RoomController {

@Autowired
RoomDao roomDao;

@RequestMapping(method = RequestMethod.GET,headers="Accept=application/json")
public String getAllUsers() {
    String users="hello welcome";
    return users;
}

public List&lt;RoomMembers&gt; getRoomMembers() {
    List&lt;RoomMembers&gt; roomMemberList=roomDao.listMember();
    //User user=userService.getUserById(id);
    return roomMemberList;
}
}
</code></pre>

<p>Model class:</p>

<pre><code>@Entity
@Table(name="RoomMembers")
public class RoomMembers{

@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name = "memberId")
private int memberId;

@Column(name="memberName")
private String memberName;

@Column(name="Phone")
private long phone;

@Column(name="address")
private String address;

public int getMemberId() {
    return memberId;
}

public void setMemberId(int memberId) {
    this.memberId = memberId;
}

public String getMemberName() {
    return memberName;
}

public void setMemberName(String memberName) {
    this.memberName = memberName;
}

public long getPhone() {
    return phone;
}

public void setPhone(long phone) {
    this.phone = phone;
}

public String getAddress() {
    return address;
}

public void setAddress(String address) {
    this.address = address;
}


}
</code></pre>

<p>Dao:</p>

<pre><code>public interface RoomDao {

public List&lt;RoomMembers&gt; listMember();

}
</code></pre>

<p>DaoImpl:</p>

<pre><code>@Repository
@Transactional
public class RoomDaoImpl implements RoomDao{

@Autowired
private SessionFactory sessionFactory;

@SuppressWarnings("unchecked")
public List&lt;RoomMembers&gt; listMember() {
    List&lt;RoomMembers&gt; roomMemberList= (List&lt;RoomMembers&gt;)  sessionFactory.getCurrentSession().createCriteria(RoomMembers.class).list();
    return roomMemberList;
}

}
</code></pre>

<p>XML:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
    http://www.springframework.org/schema/beans     
    http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-4.0.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"&gt;

    &lt;context:property-placeholder location="classpath:resources/database.properties" /&gt;
&lt;context:component-scan base-package="com.Room.Controller" /&gt;
&lt;tx:annotation-driven transaction-manager="hibernateTransactionManager"/&gt;


&lt;bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
    &lt;property name="driverClassName" value="${database.driver}" /&gt;
    &lt;property name="url" value="${database.url}" /&gt;
    &lt;property name="username" value="${database.user}" /&gt;
    &lt;property name="password" value="${database.password}" /&gt;
&lt;/bean&gt;

&lt;bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"&gt;
    &lt;property name="dataSource" ref="dataSource" /&gt;
    &lt;property name="annotatedClasses"&gt;
    &lt;list&gt;
        &lt;value&gt;com.Room.Model.RoomMembers&lt;/value&gt;
    &lt;/list&gt;
    &lt;/property&gt;
    &lt;property name="hibernateProperties"&gt;
        &lt;props&gt;
            &lt;prop key="hibernate.dialect"&gt;${hibernate.dialect}&lt;/prop&gt;
            &lt;prop key="hibernate.show_sql"&gt;${hibernate.show_sql}&lt;/prop&gt;
            &lt;prop key="hibernate.hbm2ddl.auto"&gt;${hibernate.hbm2ddl.auto}&lt;/prop&gt;             
        &lt;/props&gt;
    &lt;/property&gt;
&lt;/bean&gt;

&lt;bean id="hibernateTransactionManager"
    class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;
    &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
&lt;/bean&gt;
&lt;mvc:annotation-driven /&gt;
</code></pre>

<p></p>