I created an AbstractInjectableModel for this. It does dependency
injection for models, the same way as in components.

Would this be something for in the wicket-spring-annot project?

Bart.

> -----Oorspronkelijk bericht-----
> Van: Igor Vaynberg [mailto:[EMAIL PROTECTED]
> Verzonden: dinsdag 19 februari 2008 4:41
> Aan: users@wicket.apache.org
> Onderwerp: Re: Spring injecting beans into non-component classes
>
> add this to the constructor of the class you want injected:
> InjectorHolder.getInjector().inject(this);
>
> -igor
>
>
> On Feb 18, 2008 7:37 PM, Warren <[EMAIL PROTECTED]> wrote:
> > I am using Spring to manage my Services and DAOs. Is there
> a special Wicket
> > way of injecting my beans into non component classes? I've
> seen the example
> > in Kent Ka Iok Tong's book of extending SpringWebApplication:
> >
> > public class MyApp extends SpringWebApplication {
> > ...
> > @Override
> > protected void init() {
> > addComponentInstantiationListener(new
> SpringComponentInjector(this));
> > }
> > ...
> >
> > and then in my components:
> >
> > @SpringBean
> > private MyService myService;
> >
> > I am assuming that this will only work for components. I am
> currently
> > injecting my beans the following way thru the constructor
> of my classes:
> >
> > ...
> >
> > private MyService myService;
> >
> >         public MyClass()
> >         {
> >                 myService =
> > (MyService)SpringInit.getApplicationContext().getBean("myService");
> >         }
> >
> > Where SpringInit is my class that implements
> ServletContextListener. This
> > way works, but is there a special way of doing this in
> Wicket with the
> > @SpringBean annotation? Also, will the example at the top
> of the page work
> > within a model?
> >
> > Thanks,
> >
> > Warren Bell
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to