You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Hugues Pichereau <wk...@hugues-pichereau.com> on 2007/11/18 11:15:39 UTC

Spring bean in session with annotation

I've successfully implemented Spring injection in *pages*, using annotations
from the wicket-spring-annot jar.

But when I try to inject a bean in the *session* class:

public class WkSession extends AuthenticatedWebSession {
   @SpringBean
   private UserService userService;
   // getter / setter
}

the bean remains null.

Apart from that, the session works great.

Is it required to use a different approach to inject beans in session?


	



-----
Regards,
Hugues
-- 
View this message in context: http://www.nabble.com/Spring-bean-in-session-with-annotation-tf4829705.html#a13817750
Sent from the Wicket - User 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: Spring bean in session with annotation

Posted by Hugues Pichereau <wk...@hugues-pichereau.com>.
Yes, I just found it in the Javadoc of SpringComponentInjector, and was about
to post it, but you have been faster! 
Anyway, thank you.

Best regards,
Hugues


Timo Rantalaiho wrote:
> 
> On Sun, 18 Nov 2007, Hugues Pichereau wrote:
>> I've successfully implemented Spring injection in *pages*, using
>> annotations
>> from the wicket-spring-annot jar.
>> 
>> But when I try to inject a bean in the *session* class:
> 
> Call InjectorHolder.getInjector().inject(this); in your
> Session class constructor.
> 
> Best wishes,
> Timo
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 


-----
Regards,
Hugues
-- 
View this message in context: http://www.nabble.com/Spring-bean-in-session-with-annotation-tf4829705.html#a13818158
Sent from the Wicket - User 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: Spring bean in session with annotation

Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Sun, 18 Nov 2007, Hugues Pichereau wrote:
> I've successfully implemented Spring injection in *pages*, using annotations
> from the wicket-spring-annot jar.
> 
> But when I try to inject a bean in the *session* class:

Call InjectorHolder.getInjector().inject(this); in your
Session class constructor.

Best wishes,
Timo


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