title: org.springframework.beans.factory.BeanCreationException & org.springframework.beans.BeanInstantiationException,No default constructor found
body: <p>I am trying to use facebook api to create a facebook application using spring + thymeleaf + hibernate if I am trying to inject an Facebook parameter to the constructor </p>
  
  <p>its showing the following error</p>
  
  <pre><code>Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'facebookController' defined in file [D:\ff-sdefault constructor found; nested exception is java.lang.NoSuchMethodException: com.ff.FacebookController$$EnhancerByCGLIB$$80bb261.&lt;init&gt;()
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1030)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:975)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:299)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:295)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:665)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
      at org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext.refresh(AnnotationConfigEmbeddedWebApplicationContext.java:193)
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:514)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:281)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:697)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:686)
      at com.fff.Application.main(Application.java:192)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
  Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.ff.FacebookController$$EnhancerByCGLIB$$80bb261]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.fff.FacebookController$$EnhancerByCGLIB$$80bb261.&lt;init&gt;()
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:85)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1023)
      ... 21 more
  Caused by: java.lang.NoSuchMethodException: com.fff.FacebookController$$EnhancerByCGLIB$$80bb261.&lt;init&gt;()
      at java.lang.Class.getConstructor0(Class.java:2800)
      at java.lang.Class.getDeclaredConstructor(Class.java:2043)
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:80)
      ... 22 more
  2013-11-04 16:30:27.157  INFO 5132 --- [           main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
  </code></pre>
  
  <p>and this is the code</p>
  
  <pre><code>package com.fff;
  
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.context.annotation.ComponentScan;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.social.facebook.api.Facebook;
  import org.springframework.stereotype.Controller;
  import org.springframework.ui.Model;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  
  import javax.inject.Inject;
  
  @Controller
  @RequestMapping("/facebook")
  @Configuration
  @ComponentScan("com.fff.service")
  public class FacebookController {
      private Facebook facebook;
  
      @Autowired
      private RegisterUserService registerUserService;
  
      @Inject
      public FacebookController(Facebook facebook) {
          this.facebook = facebook;
      }
  
      @RequestMapping(value = "/register", method = RequestMethod.GET)
      public String register(Model model) {
          if (!facebook.isAuthorized()) {
              return "redirect:/connect/facebook";
          }
          String email = facebook.userOperations().getUserProfile().getEmail();
          String name = facebook.userOperations().getUserProfile().getName();
          String firstName = facebook.userOperations().getUserProfile().getFirstName();
          String lastName = facebook.userOperations().getUserProfile().getLastName();
          String middleName = facebook.userOperations().getUserProfile().getMiddleName();
          String dateOfBirth = facebook.userOperations().getUserProfile().getBirthday();
          String userName = facebook.userOperations().getUserProfile().getUsername();
          String gender = facebook.userOperations().getUserProfile().getGender();
          String religion = facebook.userOperations().getUserProfile().getReligion();
  
          model.addAttribute("user", new User(name, firstName, lastName));
  
          return "registration";
      }
  
      @RequestMapping(value = "/save", method = RequestMethod.POST)
      public String save(Model model, User user) {
          registerUserService.registerUser(user);
          return "redirect:/";
      }
  }
  </code></pre>