title: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'signupController' defined in file
body: <p>Im previously wrote the code which save data from form in spring and it worked fine.
  Now i have tried to wrote the code which get data from android client and save it in mysql database. but in result i have a problem </p>
  
  <p>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'signupController' defined in file </p>
  
  <p>Also i dont understand why i have such problem if i have in dispatcher-servet </p>
  
  <pre><code>&lt;context:component-scan base-package="com.dubovskiyM.mvc"/&gt;
  &lt;context:annotation-config/&gt;
  </code></pre>
  
  <p>Or can this problem cause because controller and repository situated in differends folders. but in one package com.dubovskiyM.mvc?</p>
  
  <p>My files</p>
  
  <p>Controller </p>
  
  <pre><code>@Controller
  @RequestMapping("/test")
  public class SignupController {
  
  private Reg_repository reg_repository;
  
  
  
      @Autowired
   public SignupController(Reg_repository reg_repository) {
       this.reg_repository = reg_repository;
     }
  
      @RequestMapping(method = RequestMethod.POST)
   public @ResponseBody String signupm(@RequestBody String s){
  
      Gson  gson = new Gson();
      Signup signup =  gson.fromJson(s,Signup.class);
  
      return signup.getLogin();}
  }
  </code></pre>
  
  <p>Dispatcher </p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
         xmlns:beans="http://www.springframework.org/schema/mvc"
  
         xsi:schemaLocation="http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans.xsd
          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"&gt;
  
      &lt;context:component-scan base-package="com.dubovskiyM.mvc"/&gt;
  
  
      &lt;context:annotation-config/&gt;
      &lt;tx:annotation-driven transaction-manager="transactionManager" /&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;bean id="sessionFactory"
            class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
          &lt;property name="packagesToScan"
                    value="com.dubovskiyM.mvc.entity" /&gt;
          &lt;property name="hibernateProperties"&gt;
              &lt;props&gt;
                  &lt;prop key="hibernate.current_session_context_class"&gt;thread&lt;/prop&gt;
                  &lt;prop key="hibernate.current_session_context_class"&gt;
                      org.springframework.orm.hibernate4.SpringSessionContext
                  &lt;/prop&gt;
                  &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/prop&gt;
              &lt;/props&gt;
  
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
          &lt;property name="driverClassName" value="com.mysql.jdbc.Driver" /&gt;
          &lt;property name="url" value="jdbc:mysql://localhost:3306/andr_spring" /&gt;
          &lt;property name="username" value="root" /&gt;
          &lt;property name="password" value="181987" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="transactionManager"
            class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
          &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
      &lt;/bean&gt;
  </code></pre>
  
  <p>Repository</p>
  
  <pre><code>@Repository
  
  public class Reg_repository implements ResumeDAO {
  
      private final Logger log = LoggerFactory.getLogger(getClass());
  
      @Autowired
      private SessionFactory sessionFactory;
  
      @Override
      @Transactional(readOnly = true)
      public Signup find(String login) {
          log.trace("Find UserDAO with id = " + login + " ...");
          Signup signup = (Signup) sessionFactory.getCurrentSession().get(Signup.class,login);
          if (signup != null) {
              log.trace("Find UserDAO with id: " + signup.getLogin());
          }
  
          return signup;
      }
  
      @Override
      public Set&lt;Signup&gt; findAll() {
          return null;
      }
  
      @Override
      @Transactional(readOnly = false)
      public void save(Signup signup) {
          // if(find(signup.getLogin()) == null) {
           sessionFactory.getCurrentSession().save(signup);
         // }
      }
  
      @Override
      @Transactional(readOnly = false)
      public void update(Signup signup) {
          if(find(signup.getLogin()) != null) {
              sessionFactory.getCurrentSession().update(signup);
          }
      }
  
      @Override
      @Transactional(readOnly = false)
      public void remove(Signup signup) {
          if(find(signup.getLogin()) != null) {
              sessionFactory.getCurrentSession().delete(signup);
          }
      }
  }
  </code></pre>
  
  <p>Trace</p>
  
  <pre><code>javax.servlet.ServletException: Servlet.init() for servlet mvc-dispatcher threw exception
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
      org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
      org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
      org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
      org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      java.lang.Thread.run(Thread.java:724)
  
  root cause
  
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'signupController' defined in file [D:\Server\And_server\And_server\target\And_server\WEB-INF\classes\com\dubovskiyM\mvc\controller\SignupController.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.dubovskiyM.mvc.controller.SignupController]: Illegal arguments for constructor; nested exception is java.lang.IllegalArgumentException: argument type mismatch
      org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:288)
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1051)
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:955)
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490)
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
      org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
      org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
      org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
      org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
      org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
      org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
      org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:651)
      org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:599)
      org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:665)
      org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:518)
      org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:459)
      org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
      javax.servlet.GenericServlet.init(GenericServlet.java:158)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
      org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
      org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
      org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
      org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      java.lang.Thread.run(Thread.java:724)
  
  root cause
  
  org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.dubovskiyM.mvc.controller.SignupController]: Illegal arguments for constructor; nested exception is java.lang.IllegalArgumentException: argument type mismatch
      org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:159)
      org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:121)
      org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280)
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1051)
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:955)
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490)
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
      org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
      org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
      org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
      org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
      org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
      org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
      org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:651)
      org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:599)
      org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:665)
      org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:518)
      org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:459)
      org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
      javax.servlet.GenericServlet.init(GenericServlet.java:158)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
      org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
      org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
      org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
      org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      java.lang.Thread.run(Thread.java:724)
  
  root cause
  
  java.lang.IllegalArgumentException: argument type mismatch
      sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)
      org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:121)
      org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280)
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1051)
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:955)
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490)
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
      org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
      org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
      org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
      org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
      org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
      org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
      org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:651)
      org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:599)
      org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:665)
      org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:518)
      org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:459)
      org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
      javax.servlet.GenericServlet.init(GenericServlet.java:158)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
      org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
      org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
      org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
      org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      java.lang.Thread.run(Thread.java:724)
  </code></pre>