title: Could not autowire. No beans of ... type found
body: <p>can you help me solve why i can't autowire a class??
  class UserDaoImpl:</p>
  
  <pre><code>@Repository
  public class UserDaoImpl implements UserDao {
  
      @Autowired
      private SessionFactory sessionFactory;
  
      @Override
      public void addUser(User user) {
          sessionFactory.getCurrentSession().save(user);
      }
  
      @Override
      public List&lt;User&gt; getUsers() {
          return sessionFactory.getCurrentSession().createSQLQuery("SELECT * FROM user").list();
      }
  
  }
  </code></pre>
  
  <p>i want this class autowire into other class:</p>
  
  <pre><code>@Service
  public class UserServiceImpl implements UserService {
  
      @Autowired
      private UserDao userDao; //here is the error
  
      @Override
      public void addUser(User user) {
  
      }
  
      @Override
      public List&lt;User&gt; getUsers() {
          return null;
      }
  
  }
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>@Controller
  public class UserController {
  
      @Autowired
      UserService userService;
  
      String message = "This should be a list of users";
  
      @RequestMapping("/user")
      public ModelAndView showMessage() {
          ModelAndView modelAndView = new ModelAndView("user");
          modelAndView.addObject("message", message);
          return modelAndView;
      }
  
  }
  </code></pre>
  
  <p>where can be the problem? should i show you more files? thanks.
  EDIT: ok so this is my session-factory.xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"&gt;
  
      &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
          &lt;property name="hibernateProperties"&gt;
              &lt;props&gt;
                  &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.PostgreSQLDialect&lt;/prop&gt;
                  &lt;prop key="hibernate.connection.driver_class"&gt;org.postgresql.Driver&lt;/prop&gt;
                  &lt;prop key="hibernate.connection.url"&gt;jdbc:postgresql://localhost:8080/****&lt;/prop&gt;
                  &lt;prop key="hibernate.connection.username"&gt;****&lt;/prop&gt;
                  &lt;prop key="hibernate.connection.password"&gt;****&lt;/prop&gt;
                  &lt;prop key="hibernate.current_session_context_class"&gt;thread&lt;/prop&gt;
                  &lt;prop key="show_sql"&gt;true&lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt;
          &lt;property name="annotatedClasses"&gt;
              &lt;list&gt;
                  &lt;value&gt;model.User&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
   &lt;/beans&gt;
  </code></pre>
  
  <p>-class User is simple POJO which is mapped with hibernate. And maybe web.xml can help us :)</p>
  
  <pre><code>&lt;web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
            http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
           version="2.5"&gt;
  
      &lt;display-name&gt;Archetype Created Web Application&lt;/display-name&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.htm&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/mvc-dispatcher-servlet.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>mvc-servlet-dispatcher.xml:</p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:context="http://www.springframework.org/schema/context"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="
          http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
          http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt;
  
      &lt;context:component-scan base-package="controller" /&gt;
  
      &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
          &lt;property name="prefix" value="/WEB-INF/pages/" /&gt;
          &lt;property name="suffix" value=".jsp" /&gt;
      &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>and i don't have any applicationContext.xml file, maybe this can be the problem, can you help me with that?
  I'm adding a screenshot of my project and problem: <a href="http://screenshot.cz/75QVH/">http://screenshot.cz/75QVH/</a></p>