title: Wicket @SpringBean and Spring @Autowired with injection via constructor
body: <p>I have a Wicket panel in which I want to inject bean using @SpringBean</p>
  
  <pre><code>public class SomePanel extends Panel {
  
    @SpringBean
    private BlogSummaryMailGenerator blogSummaryMailGenerator;
  
  }
  </code></pre>
  
  <p>But this BlogSummaryMailGenerator has injection via constructor defined like this:</p>
  
  <pre><code>@Component
  public class BlogSummaryMailGenerator {
  
    private BlogRepository blogRepository;
    private BlogPostRepository blogPostRepository;
  
    @Autowired
    public BlogSummaryMailGenerator(BlogRepository blogRepository,
                                  BlogPostRepository blogPostRepository) {
      this.blogRepository = blogRepository;
      this.blogPostRepository = blogPostRepository;
    }
  }
  </code></pre>
  
  <p>And when SomePanel is instantiated I am getting an exception</p>
  
  <pre><code>Caused by: java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
  at net.sf.cglib.proxy.Enhancer.emitConstructors(Enhancer.java:721) ~[cglib-3.1.jar:na]
  at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:499) ~[cglib-3.1.jar:na]
  at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) ~[cglib-3.1.jar:na]
  at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216) ~[cglib-3.1.jar:na]
  at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377) ~[cglib-3.1.jar:na]
  at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285) ~[cglib-3.1.jar:na]
  at org.apache.wicket.proxy.LazyInitProxyFactory.createProxy(LazyInitProxyFactory.java:191) ~[wicket-ioc-7.2.0.jar:7.2.0]
  </code></pre>
  
  <p>Adding empty no-args constructor to the BlogSummaryMailGenerator solves this issue but adding such code only to make injection work is wrong and I would like to avoid it.</p>
  
  <p>Any suggestions how to make @SpringBean work with beans using injection via constructor?</p>