You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Chris <ch...@gmx.at> on 2015/02/12 19:17:35 UTC
@SpringBean annotation, no-arg constructor
Hi,
when injecting a bean via @SpringBean annotation into a Wicket page, this bean must provide a default constructor, otherwise I am receiving the error: java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
Is there a solution to inject beans without no-arg constructors?
thanks a lot,
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: @SpringBean annotation, no-arg constructor
Posted by Martin Grigorov <mg...@apache.org>.
https://issues.apache.org/jira/browse/WICKET-1130
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
On Thu, Feb 12, 2015 at 11:44 PM, Rodrigo Ribeiro Miguele <
rodrigo.miguele@maps.com.br> wrote:
> The problem occurs when the injector will try to create a serializable
> proxy that will make reference to your bean. If your class does not have an
> empty constructor, your code-generation library (CGLIB, javassist, etc)
> cannot create a "class" that extends it to use in the generated proxy,
> throwing IllegalArgumentException. For this reason, your class should
> implement an interface that describes all the methods you need to use and
> injecting a bean of its type.
>
> 2015-02-12 19:19 GMT-02:00 Tobias Soloschenko <
> tobiassoloschenko@googlemail.com>:
>
> > Forgot to say if you use constructor-arg
> >
> > kind regards
> >
> > Tobias
> >
> > > Am 12.02.2015 um 21:13 schrieb Andrea Del Bene <an...@gmail.com>:
> > >
> > > Hi,
> > >
> > > it looks like more a Spring problem rather than a Wicket one. What's
> > your full stacktrace?
> > >> Hi,
> > >>
> > >> when injecting a bean via @SpringBean annotation into a Wicket page,
> > this bean must provide a default constructor, otherwise I am receiving
> the
> > error: java.lang.IllegalArgumentException: Superclass has no null
> > constructors but no arguments were given
> > >>
> > >> Is there a solution to inject beans without no-arg constructors?
> > >>
> > >> thanks a lot,
> > >> Chris
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > >> For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Rodrigo Ribeiro Miguele
>
Re: @SpringBean annotation, no-arg constructor
Posted by Rodrigo Ribeiro Miguele <ro...@maps.com.br>.
The problem occurs when the injector will try to create a serializable
proxy that will make reference to your bean. If your class does not have an
empty constructor, your code-generation library (CGLIB, javassist, etc)
cannot create a "class" that extends it to use in the generated proxy,
throwing IllegalArgumentException. For this reason, your class should
implement an interface that describes all the methods you need to use and
injecting a bean of its type.
2015-02-12 19:19 GMT-02:00 Tobias Soloschenko <
tobiassoloschenko@googlemail.com>:
> Forgot to say if you use constructor-arg
>
> kind regards
>
> Tobias
>
> > Am 12.02.2015 um 21:13 schrieb Andrea Del Bene <an...@gmail.com>:
> >
> > Hi,
> >
> > it looks like more a Spring problem rather than a Wicket one. What's
> your full stacktrace?
> >> Hi,
> >>
> >> when injecting a bean via @SpringBean annotation into a Wicket page,
> this bean must provide a default constructor, otherwise I am receiving the
> error: java.lang.IllegalArgumentException: Superclass has no null
> constructors but no arguments were given
> >>
> >> Is there a solution to inject beans without no-arg constructors?
> >>
> >> thanks a lot,
> >> Chris
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Rodrigo Ribeiro Miguele
Re: @SpringBean annotation, no-arg constructor
Posted by Tobias Soloschenko <to...@googlemail.com>.
Forgot to say if you use constructor-arg
kind regards
Tobias
> Am 12.02.2015 um 21:13 schrieb Andrea Del Bene <an...@gmail.com>:
>
> Hi,
>
> it looks like more a Spring problem rather than a Wicket one. What's your full stacktrace?
>> Hi,
>>
>> when injecting a bean via @SpringBean annotation into a Wicket page, this bean must provide a default constructor, otherwise I am receiving the error: java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
>>
>> Is there a solution to inject beans without no-arg constructors?
>>
>> thanks a lot,
>> Chris
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: @SpringBean annotation, no-arg constructor
Posted by Tobias Soloschenko <to...@googlemail.com>.
Hi,
yes it is a Spring requirement that a bean must have a default constructor. Otherwise use a bean factory.
kind regards
Tobias
> Am 12.02.2015 um 21:13 schrieb Andrea Del Bene <an...@gmail.com>:
>
> Hi,
>
> it looks like more a Spring problem rather than a Wicket one. What's your full stacktrace?
>> Hi,
>>
>> when injecting a bean via @SpringBean annotation into a Wicket page, this bean must provide a default constructor, otherwise I am receiving the error: java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
>>
>> Is there a solution to inject beans without no-arg constructors?
>>
>> thanks a lot,
>> Chris
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: @SpringBean annotation, no-arg constructor
Posted by Andrea Del Bene <an...@gmail.com>.
Hi,
it looks like more a Spring problem rather than a Wicket one. What's
your full stacktrace?
> Hi,
>
> when injecting a bean via @SpringBean annotation into a Wicket page, this bean must provide a default constructor, otherwise I am receiving the error: java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
>
> Is there a solution to inject beans without no-arg constructors?
>
> thanks a lot,
> Chris
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: @SpringBean annotation, no-arg constructor
Posted by Chris <ch...@gmx.at>.
Thanks a lot!
> Am 12.02.2015 um 20:12 schrieb Rodrigo Ribeiro Miguele <ro...@maps.com.br>:
>
> Just make your class implement an interface then use it instead your class
> when injecting your bean.
>
> 2015-02-12 16:17 GMT-02:00 Chris <ch...@gmx.at>:
>
>> Hi,
>>
>> when injecting a bean via @SpringBean annotation into a Wicket page, this
>> bean must provide a default constructor, otherwise I am receiving the
>> error: java.lang.IllegalArgumentException: Superclass has no null
>> constructors but no arguments were given
>>
>> Is there a solution to inject beans without no-arg constructors?
>>
>> thanks a lot,
>> Chris
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> --
> Rodrigo Ribeiro Miguele
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: @SpringBean annotation, no-arg constructor
Posted by Rodrigo Ribeiro Miguele <ro...@maps.com.br>.
Just make your class implement an interface then use it instead your class
when injecting your bean.
2015-02-12 16:17 GMT-02:00 Chris <ch...@gmx.at>:
> Hi,
>
> when injecting a bean via @SpringBean annotation into a Wicket page, this
> bean must provide a default constructor, otherwise I am receiving the
> error: java.lang.IllegalArgumentException: Superclass has no null
> constructors but no arguments were given
>
> Is there a solution to inject beans without no-arg constructors?
>
> thanks a lot,
> Chris
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Rodrigo Ribeiro Miguele