@Configurable is used to enable Spring to inject dependencies into a non-Spring-managed object ie into an object Spring doesn't control the lifecycle of, and in particular, one that Spring does not create for you (eg the developer, and not Spring, uses the new keyword and a constructor, or some factory method directly to create an instance).
@SpringBean is a clever option available in Wicket; the object created and passed into your component (often a page) will be a Wicket created proxy to a bean managed by Spring (eg to a service facade implementation). One of the key benefits of Wicket's "injection" mechanism is that when this page/component is serialised, only this proxy needs to be written (not the potentially huge object graph that makes up the underlying object ie the thing you would probably have considered asking Spring to inject using @Configurable which could be a service object carrying several DAOs and all their luggage ...). This enables the Wicket framework to hand your page a reference to a an object (the proxy) that is tuned to work well in the world of a Wicket application, whilst still providing access to all the functionality of the underlying, potentially heavy, Spring bean, without burdening you with the problems of serialising it.
Regards - Cemal
http://jWeekend.co.uk
Leon Faltermeyer wrote:
Hi,
Is there any difference in using Spring framework' s @Configurable
annotation or wicket's @SpringBean.
I'm already using @Configurable within my domain objects.
I just mind, if I could use @Configurable in my UI layer for DI as well.
regards,
Leon