title: Error creating bean with name 'empController': Injection of autowired dependencies failed
body: <p><strong>Controller Class</strong></p>
  
  <pre><code>package com.beas.controller;
  
  import org.springframework.beans.factory.annotation.Autowired;
  
  import org.springframework.stereotype.Controller;
  
  import org.springframework.ui.Model;
  
  import org.springframework.web.bind.annotation.ModelAttribute;
  
  import org.springframework.web.bind.annotation.RequestMapping;
  
  import org.springframework.web.bind.annotation.RequestMethod;
  
  import com.beas.dto.EmpDto;
  
  import com.beas.service.EmpService;
  
  @Controller
  
  public class EmpController {
  
      @Autowired
  
      EmpService empService;
  
      @RequestMapping(value = "/signUp")
  
      public String welcome(Model model) {
  
          model.addAttribute("empForm", new EmpDto());
  
          return "SignUpForm";
      }
  
      @RequestMapping(value = "/next", method = RequestMethod.POST)
  
      public String empFormSubmit(@ModelAttribute("empForm") EmpDto empDto) {
  
      empService.addEmpDetails(empDto);
  
          return "Done";
      }
  
  }
  </code></pre>
  
  <p><strong>Service Class</strong></p>
  
  <pre><code>package com.beas.service;
  
  import com.beas.dto.EmpDto;
  
  public interface EmpService {
  
   public void addEmpDetails(EmpDto empDto);  
  
  }
  </code></pre>
  
  <p><strong>ServiceImplement Class</strong></p>
  
  <pre><code>package com.beas.service;
  
  import org.springframework.beans.factory.annotation.Autowired;
  
  import org.springframework.stereotype.Service;
  
  import com.beas.dto.EmpDto;
  
  import com.beas.repository.EmpRepository;
  
  @Service("empService")
  
  public class EmpServiceImpl implements EmpService{
  
      @Autowired
  
      EmpRepository empRepository;
  
      public void addEmpDetails(EmpDto empDto) {
  
          empRepository.addEmpDetails(empDto);
  
      }
  
  }
  </code></pre>
  
  <p><strong>Repository Class</strong></p>
  
  <pre><code>package com.beas.repository;
  
  import com.beas.dto.EmpDto;
  
  public interface EmpRepository {
  
      public void addEmpDetails(EmpDto empDto);   
  }
  </code></pre>
  
  <p><strong>Repository Implementation Class</strong></p>
  
  <pre><code>package com.beas.repository;
  
  import org.hibernate.SessionFactory;
  
  import org.springframework.beans.factory.annotation.Autowired;
  
  import org.springframework.stereotype.Repository;
  
  import com.beas.dto.EmpDto;
  
  @Repository("empRepository")
  
  public class EmpRepositoryImpl implements EmpRepository{
  
      @Autowired  
       private SessionFactory sessionFactory;
  
      public void addEmpDetails(EmpDto empDto) {
  
          sessionFactory.getCurrentSession().saveOrUpdate(empDto);    
  
      }
  
  }
  </code></pre>
  
  <p><strong>Pom.xml</strong></p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" 
  
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
  http://maven.apache.org/maven-v4_0_0.xsd"&gt;
  
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.beas&lt;/groupId&gt;
  
      &lt;artifactId&gt;SpringMvcForm&lt;/artifactId&gt;
  
      &lt;packaging&gt;war&lt;/packaging&gt;
  
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  
      &lt;name&gt;SpringMvcForm Maven Webapp&lt;/name&gt;
  
      &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
      &lt;dependencies&gt;
  
          &lt;dependency&gt;
  
              &lt;groupId&gt;junit&lt;/groupId&gt;
  
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
  
              &lt;version&gt;3.8.1&lt;/version&gt;
  
              &lt;scope&gt;test&lt;/scope&gt;
  
          &lt;/dependency&gt;
  
          &lt;!-- Spring --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
  
              &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
  
              &lt;version&gt;3.0.5.RELEASE&lt;/version&gt;
  
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
  
  
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
  
              &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
  
              &lt;version&gt;3.0.5.RELEASE&lt;/version&gt;
  
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
  
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
  
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
  
              &lt;version&gt;3.0.5.RELEASE&lt;/version&gt;
  
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
  
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
  
              &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
  
              &lt;version&gt;3.0.5.RELEASE&lt;/version&gt;
  
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
  
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
  
              &lt;artifactId&gt;spring-tx&lt;/artifactId&gt;
  
              &lt;version&gt;3.0.5.RELEASE&lt;/version&gt;
  
          &lt;/dependency&gt;
  
          &lt;!-- hibernate --&gt;
  
          &lt;dependency&gt;
  
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
  
              &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
  
              &lt;version&gt;3.6.10.Final&lt;/version&gt;
  
          &lt;/dependency&gt;
  
  
          &lt;dependency&gt;
  
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
  
              &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
  
              &lt;version&gt;4.2.0.Final&lt;/version&gt;
  
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
  
              &lt;groupId&gt;com.oracle&lt;/groupId&gt;
  
              &lt;artifactId&gt;ojdbc6&lt;/artifactId&gt;
  
              &lt;version&gt;11.2.0.3&lt;/version&gt;
  
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
  
              &lt;groupId&gt;javax.validation&lt;/groupId&gt;
  
              &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
  
              &lt;version&gt;1.1.0.Final&lt;/version&gt;
  
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
      &lt;build&gt;
  
          &lt;finalName&gt;SpringMvcForm&lt;/finalName&gt;
  
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p><strong>Web.xml</strong></p>
  
  <p></p>
  
  <p></p>
  
  <p>Archetype Created Web Application</p>
  
  <p></p>
  
  <pre><code> &lt;servlet-name&gt;SpringMvc&lt;/servlet-name&gt;
  
   &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
  
   &lt;init-param&gt;
  
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;&lt;param-value&gt;/WEB-INF/springForm-servlet.xml&lt;/param-value&gt;&lt;/init-param&gt;
  
   &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  </code></pre>
  
  <p></p>
  
  <p></p>
  
  <p>SpringMvc</p>
  
  <p>/</p>
  
  <p></p>
  
  <p></p>
  
  <p><strong>springForm-servlet.xml</strong></p>
  
  <pre><code>&lt;beans  xmlns="http://www.springframework.org/schema/beans" 
          xmlns:context="http://www.springframework.org/schema/context" 
          xmlns:tx="http://www.springframework.org/schema/tx" 
          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
                   http://www.springframework.org/schema/tx
                   http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"&gt;
  
       &lt;context:component-scan base-package="com.beas.controller"/&gt;
  
       &lt;context:component-scan base-package="com.beas.service"/&gt;
  
      &lt;context:component-scan base-package="com.beas.repository"/&gt;
  
     &lt;tx:annotation-driven transaction-manager="hibernateTransactionManager"/&gt;
  
  
     &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" id="jspViewResolver"&gt;
  
         &lt;property name="viewClass" value="org.springframework.web.servlet.view.JstlView"&gt;&lt;/property&gt;
  
        &lt;property name="prefix" value="/WEB-INF/pages/"&gt;&lt;/property&gt;
  
        &lt;property name="suffix" value=".jsp"&gt;&lt;/property&gt;
  
      &lt;/bean&gt;
  
      &lt;bean class="org.springframework.jdbc.datasource.DriverManagerDataSource" id="dataSource"&gt;
  
         &lt;property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"&gt;
  
         &lt;/property&gt;
  
           &lt;property name="url" value="jdbc:oracle:thin:@192.168.1.7:1521:beasproj"&gt;
  
       &lt;/property&gt;
  
          &lt;property name="username" value="scott"&gt;&lt;/property&gt;
  
          &lt;property name="password" value="tiger"&gt;&lt;/property&gt;
  
      &lt;/bean&gt;
  
       &lt;bean class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" id="sessionFactory"&gt;
  
        &lt;property name="dataSource" ref="dataSource"&gt;&lt;/property&gt;
  
       &lt;property name="annotatedClasses"&gt;
  
         &lt;list&gt;
  
            &lt;value&gt;com.beas.dto.EmpDto&lt;/value&gt;
  
         &lt;/list&gt;
  
        &lt;/property&gt;
  
      &lt;property name="hibernateProperties"&gt;
  
         &lt;props&gt;
  
          &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.Oracle9Dialect&lt;/prop&gt;
  
          &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
  
          &lt;prop key="hibernate.hbm2ddl.auto"&gt;update&lt;/prop&gt;  
  
            &lt;/props&gt;
  
           &lt;/property&gt;
  
      &lt;/bean&gt;
  
      &lt;bean class="org.springframework.orm.hibernate3.HibernateTransactionManager" id="hibernateTransactionManager"&gt;
  
         &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;
  
       &lt;/bean&gt;
  
     &lt;/beans&gt;
  </code></pre>
  
  <p>Please Help me to solve this error.</p>
  
  <p>Thank you.</p>