title: No default constructor found; nested exception is java.lang.NoSuchMethodException bean configuration
body: <p>I am trying to run some sql on a H2 database, I believe my sql schema has run. Although I am not sure how to get a data source working. I have added the @Repository annotation and a @Autowired annotation for my data source setter, any help would be appreciated.</p>
  
  <pre><code>package ping.repositories;
  
  import javax.sql.DataSource;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.jdbc.core.JdbcTemplate;
  import org.springframework.stereotype.Repository;
  import ping.cascade.integration.CascadeInterface;
  import ping.cascade.integration.company.CascadeFactory;
  import ping.domain.Cascade;
  import ping.domain.PingRequestBody;
  
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  
  import java.util.ArrayList;
  
  @Repository
  public class CascadeListRepository {
  
      private static final Logger log = LoggerFactory.getLogger(CascadeListRepository.class);
  
      private JdbcTemplate jdbcTemplate;
      private DataSource dataSource;
  
      private ArrayList&lt;CascadeInterface&gt; cascadeList;
      private PingRequestBody pingRequestBody;
  
      public CascadeListRepository(PingRequestBody pingRequestBody){
          this.cascadeList = new ArrayList&lt;CascadeInterface&gt;();
          this.pingRequestBody = pingRequestBody;
      }
  
      @Autowired
      public void setDataSource(DataSource dataSource) {
          this.jdbcTemplate = new JdbcTemplate(dataSource);
      }
  
      public ArrayList&lt;CascadeInterface&gt; getCascadeList(){
  
          CascadeFactory cascadeFactory = new CascadeFactory();
  
  
  
          jdbcTemplate.query(
                  "SELECT cascade_id, cascade_name, cascade_object FROM cascade", 
                  (rs, rowNum) -&gt; new Cascade(rs.getInt("cascade_id"), rs.getString("cascade_name"), rs.getString("cascade_object"))
          ).forEach(cascade -&gt; log.info(cascade.toString()));
          log.info("Finished sql");
  
  
  
          return cascadeList;
      }
  }
  </code></pre>
  
  <p>And the exception is :</p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cascadeListRepository' defined in URL [jar:file:/Users/charlesbryant/projects/java/spring/cb-ping-service/build/libs/cb-ping-service-0.1.0.jar!/ping/repositories/CascadeListRepository.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [ping.repositories.CascadeListRepository]: No default constructor found; nested exception is java.lang.NoSuchMethodException: ping.repositories.CascadeListRepository.&lt;init&gt;()
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1105) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1050) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.3.RELEASE.jar!/:1.3.3.RELEASE]
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.3.RELEASE.jar!/:1.3.3.RELEASE]
      at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.3.RELEASE.jar!/:1.3.3.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.3.RELEASE.jar!/:1.3.3.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.3.RELEASE.jar!/:1.3.3.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.3.RELEASE.jar!/:1.3.3.RELEASE]
      at ping.Application.main(Application.java:10) [cb-ping-service-0.1.0.jar!/:na]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_31]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_31]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_31]
      at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_31]
      at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54) [cb-ping-service-0.1.0.jar!/:na]
      at java.lang.Thread.run(Thread.java:745) [na:1.8.0_31]
  Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [ping.repositories.CascadeListRepository]: No default constructor found; nested exception is java.lang.NoSuchMethodException: ping.repositories.CascadeListRepository.&lt;init&gt;()
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:85) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1098) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
      ... 23 common frames omitted
  Caused by: java.lang.NoSuchMethodException: ping.repositories.CascadeListRepository.&lt;init&gt;()
      at java.lang.Class.getConstructor0(Class.java:3074) ~[na:1.8.0_31]
      at java.lang.Class.getDeclaredConstructor(Class.java:2170) ~[na:1.8.0_31]
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:80) ~[spring-beans-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
  </code></pre>