title: Error creating bean with name 'adminController': Unsatisfied dependency expressed through field 'supplierDaoImpl'
body: <p>I've created this code and it works for me but suddenly it throws error when I run program.</p>
  
  <blockquote>
    <p>Error creating bean with name 'adminController': Unsatisfied dependency expressed through field 'supplierDaoImpl'.</p>
  </blockquote>
  
  <pre><code>@Component
  @Entity
  public class Supplier implements Serializable{
  
  private static final long serialVersionUID = 1L;
  @Id
  private String sId;
  @NotBlank(message = "Please enter Supplier Name!")
  private String supplierName;
  
  // SupplierDao
  
  public interface SupplierDao {
  
  boolean insertSupplier(Supplier supplier);
  boolean updateSupplier(Supplier supplier);
  boolean deleteSupplier(Supplier supplier);
  Supplier findBySupplierId(String sid);
  List&lt;Supplier&gt; retrieve();
  }
  
  //SupplierDaoImpl
  
  @Repository
  @Service
  public class SupplierDaoImpl implements SupplierDao {
  
  @Autowired
  private SessionFactory sessionFactory;
  
  @Autowired
  public SupplierDaoImpl(SessionFactory sessionFactory) {
  
      this.sessionFactory = sessionFactory;
  }
  
  @Override
  @Transactional
  public boolean insertSupplier(Supplier supplier) {
  
      try {
          Session session = sessionFactory.openSession();
          session.beginTransaction();
          session.saveOrUpdate(supplier);
          session.getTransaction().commit();
          return true;
      }catch(Exception exception) {
          return false;
      }
  }
  
  //HibernateConfig
  
  @Configuration
  @ComponentScan("com.backend.*")
  @EnableTransactionManagement
  public class HibernateConfig
  {
  
  private final static String DATABASE_URL = "jdbc:h2:tcp://localhost/~/emart";
  private final static String DATABASE_DRIVER = "org.h2.Driver";
  private final static String DATABASE_DIALECT = "org.hibernate.dialect.H2Dialect";
  private final static String DATABASE_USERNAME = "sa";
  private final static String DATABASE_PASSWORD = "";
  
  @Autowired
  @Bean(name="dataSource")
  public DataSource getH2Data()
  {
      DriverManagerDataSource dataSource = new DriverManagerDataSource();
      dataSource.setDriverClassName(DATABASE_DRIVER);
      dataSource.setUrl(DATABASE_URL);
      dataSource.setUsername(DATABASE_USERNAME);
      dataSource.setPassword(DATABASE_PASSWORD);
      System.out.println("H2 Connected"); 
      return dataSource;
  }
  private Properties getHiber()
  {
      Properties properties = new Properties();
      properties.put("hibernate.dialect", DATABASE_DIALECT);
      properties.put("hibernate.hbm2ddl.auto", "update");
      properties.put("hibernate.show_sql", "true");
      properties.put("hibernate.format_sql", "true");
      System.out.println("Tables created");
      return properties;
  }
  @Autowired
  @Bean(name="sessionFactory")
  public SessionFactory getHiberSession(DataSource dataSource)
  {
      LocalSessionFactoryBuilder localSessionFactoryBuilder = new LocalSessionFactoryBuilder(dataSource);
      localSessionFactoryBuilder.addProperties(getHiber());
      localSessionFactoryBuilder.addAnnotatedClass(User.class);
      localSessionFactoryBuilder.addAnnotatedClass(Supplier.class);
      localSessionFactoryBuilder.addAnnotatedClass(Category.class);
      localSessionFactoryBuilder.addAnnotatedClass(Products.class);
  
      return localSessionFactoryBuilder.buildSessionFactory();
  }
  
  @Autowired
  @Bean(name="supplierDaoImpl")
  public SupplierDaoImpl getSupplierData(SessionFactory sessionFactory)
  {
      return new SupplierDaoImpl(sessionFactory);
  
  }
  
  //AdminController
  
  @Controller
  @RequestMapping("/admin")
  public class AdminController
  {
  
  @Autowired
  SupplierDaoImpl supplierDaoImpl;
  
  
  //Dispatcher Servlet
  
  &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"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      http://www.springframework.org/schema/aop
      http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
      http://www.springframework.org/schema/mvc
      http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
      http://www.springframework.org/schema/context
      http://www.springframework.org/schema/context/spring-context-  3.0.xsd"&gt;
  
  &lt;context:annotation-config/&gt;
   &lt;mvc:default-servlet-handler/&gt;
   &lt;mvc:annotation-driven/&gt;  
  &lt;context:component-scan base-package="com.emart.controller"/&gt;
  &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/&gt;
      &lt;property name="prefix" value="/WEB-INF/views/"/&gt;
      &lt;property name="suffix" value=".jsp"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"&gt;
  &lt;property name="maxUploadSize" value="300000000" &gt;
  &lt;/property&gt;&lt;/bean&gt;
  
  &lt;mvc:view-controller path="/" view-name="index" /&gt;
  &lt;mvc:resources location="/assets/" mapping="/webapp/assets/**" cache-period="31556926"/&gt;
  
  
  &lt;/beans&gt;
  </code></pre>