Re: @SpringBean in init

2008-04-08 Thread Mathias P.W Nilsson
That worked like a charm! Thanks! -- View this message in context: http://www.nabble.com/%40SpringBean-in-init-tp16548410p16558424.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail:

Re: @SpringBean in init

2008-04-08 Thread Tormod Ă˜verlier
You should do it in the init method before you use the @SpringBean Mathias P.W Nilsson wrote: > > Where should I do that? > > I have done this right now and it worked > > (Application)Application.get()).getSpringContextLocator().getSpringContext().getBean( > "setting" ) > > but it is not pre

Re: @SpringBean in init

2008-04-08 Thread Mathias P.W Nilsson
Where should I do that? I have done this right now and it worked (Application)Application.get()).getSpringContextLocator().getSpringContext().getBean( "setting" ) but it is not pretty! -- View this message in context: http://www.nabble.com/%40SpringBean-in-init-tp16548410p16553797.html Sent f

Re: @SpringBean in init

2008-04-08 Thread lars vonk
You could also define your WicketApplication in your spring config by setting the applicationFactoryClassName property of the WicketFilter to org.apache.wicket.spring.SpringWebApplicationFactory. This way you don't have to manually inject your dependencies via the InjectorHolder. The only thing is

Re: @SpringBean in init

2008-04-08 Thread Tormod Ă˜verlier
Try using InjectorHolder.getInjector().inject(this); Mathias P.W Nilsson wrote: > > Hi! > > I have extended the SpringWebApplication and the init method looks like > > addComponentInstantiationListener(new SpringComponentInjector(this)); > > > I want to access my @SpringBean in the init met

Re: @SpringBean in init

2008-04-08 Thread Korbinian Bachl - privat
Ah, shame on me! youre right - in case of extending SpringWebApplication it works; in case of ext. WebApplication it wont work - thats what I mixed up - but only if not using @SpringBean but the get direct; thx for info Daniel, Regards, Korbinian Daniel Stoch schrieb: Hi, I think he can :)

Re: @SpringBean in init

2008-04-08 Thread Daniel Stoch
Hi, I think he can :). SpringWebApplication is not a Component so this: addComponentInstantiationListener(new SpringComponentInjector(this)); doesn't matter here. Before you want to use this @SpringBean in your init() method you should call: InjectorHolder.getInjector().inject(this); But then yo

Re: @SpringBean in init

2008-04-08 Thread Korbinian Bachl - privat
Hi Mathias, in short: you cant; the @SpringBean injection is usually done before the class is really created so at a time wicket and spring aren't registered yet; What you could do (not 100% sure) would be to call a simple proxy-pojo that gets you the data (even maybe a LoadableDetachable on

@SpringBean in init

2008-04-08 Thread Mathias P.W Nilsson
Hi! I have extended the SpringWebApplication and the init method looks like addComponentInstantiationListener(new SpringComponentInjector(this)); I want to access my @SpringBean in the init method but it fails. How can I do this? I need to cache all users from a webservice in application start