You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Jack Berg <er...@gmail.com> on 2011/08/15 16:41:42 UTC

Injecting beans into behaviors

Hello,

It seems that @SpringBeans does not inject beans into behaviors. It works
only in Components by calling
getApplication().notifyComponentInstantiationListeners(this) in the
constructor. Is there a reason for limiting this? An easy workaround?


Thanks for the responses to my previous questions!

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Injecting-beans-into-behaviors-tp3744739p3744739.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Injecting beans into behaviors

Posted by Martin Grigorov <mg...@apache.org>.
The limitation is that all your components extend from o.a.w.Component
while you can implement IBehavior or IModel directly and there is no
way to intercept your constructors' calls.

In Wicket 1.5 there is no IBehavior anymore and there is class
Behavior where we can do that but I'm not convinced there is such
need.

The workaround is to call: InjectorHolder.getInstance().inject(this)
in your behavior constructor.

On Mon, Aug 15, 2011 at 5:41 PM, Jack Berg <er...@gmail.com> wrote:
> Hello,
>
> It seems that @SpringBeans does not inject beans into behaviors. It works
> only in Components by calling
> getApplication().notifyComponentInstantiationListeners(this) in the
> constructor. Is there a reason for limiting this? An easy workaround?
>
>
> Thanks for the responses to my previous questions!
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Injecting-beans-into-behaviors-tp3744739p3744739.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org