|
View:
New views
10 Messages
—
Rating Filter:
Alert me
|
|
|
@SpringBean vs @ConfigurableHi,
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 |
|
|
Re: @SpringBean vs @Configurableyou have to be careful not to pass references to injected beans to
other objects. other than that i think you should be fine. -igor On Mon, Jul 21, 2008 at 9:22 AM, Leon Faltermeyer <l.fhmedia@...> 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 > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: @SpringBean vs @ConfigurableI know I should understand that, but my brain doesn't want to parse that sentence for some reason. references to injected beans - What does that mean? The domain object is an injected bean (if it was annotated with @Configurable) and a reference to it would presumably be passed to the Wicket component so that the that component could process it. Are you saying that this should be avoided? other objects - Can you maybe give an example of the "other objects" you have in mind? Matt |
|
|
Re: @SpringBean vs @Configurableclass usersdataprovider implements dataprovider {
final userservice svc; public int size() { return svc.size(); } } @configurable class userspage extends webpage { private userservce svc; public userspage() { add(new dataview("users", new dataprovider(svc))); } this takes a reference of injected userservice svc and passes it to the dataprovider. now dataprovider has a hard reference to the service and is no longer serializable. if you use a @springbean generated proxy, this would still work fine. -igor On Mon, Jul 21, 2008 at 1:50 PM, Matt Welch <matthew@...> wrote: > > > igor.vaynberg wrote: >> >> you have to be careful not to pass references to injected beans to >> other objects. other than that i think you should be fine. >> > I know I should understand that, but my brain doesn't want to parse that > sentence for some reason. > > references to injected beans - What does that mean? The domain object is an > injected bean (if it was annotated with @Configurable) and a reference to it > would presumably be passed to the Wicket component so that the that > component could process it. Are you saying that this should be avoided? > > other objects - Can you maybe give an example of the "other objects" you > have in mind? > > Matt > > -- > View this message in context: http://www.nabble.com/%40SpringBean-vs-%40Configurable-tp18572291p18577287.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: @SpringBean vs @Configurable@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
|
|
|
Re: @SpringBean vs @ConfigurableThank you. That makes sense to me now. It was a slow brain day day for me I guess. :)
Matt
|
|
|
Re: @SpringBean vs @ConfigurableThere has also been a request made to have @Configurable inject
serializable proxies. http://jira.springframework.org/browse/SPR-4777 On Mon, Jul 21, 2008 at 7:34 PM, Matt Welch <matthew@...> wrote: > > Thank you. That makes sense to me now. It was a slow brain day day for me I > guess. :) > > Matt > > > > igor.vaynberg wrote: >> >> class usersdataprovider implements dataprovider { >> final userservice svc; >> public int size() { return svc.size(); } >> } >> >> @configurable class userspage extends webpage { >> private userservce svc; >> public userspage() { >> add(new dataview("users", new dataprovider(svc))); >> } >> >> this takes a reference of injected userservice svc and passes it to >> the dataprovider. now dataprovider has a hard reference to the service >> and is no longer serializable. >> >> if you use a @springbean generated proxy, this would still work fine. >> >> -igor >> >> On Mon, Jul 21, 2008 at 1:50 PM, Matt Welch <matthew@...> wrote: >>> >>> >>> igor.vaynberg wrote: >>>> >>>> you have to be careful not to pass references to injected beans to >>>> other objects. other than that i think you should be fine. >>>> >>> I know I should understand that, but my brain doesn't want to parse that >>> sentence for some reason. >>> >>> references to injected beans - What does that mean? The domain object is >>> an >>> injected bean (if it was annotated with @Configurable) and a reference to >>> it >>> would presumably be passed to the Wicket component so that the that >>> component could process it. Are you saying that this should be avoided? >>> >>> other objects - Can you maybe give an example of the "other objects" you >>> have in mind? >>> >>> Matt >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/%40SpringBean-vs-%40Configurable-tp18572291p18577287.html >>> Sent from the Wicket - User mailing list archive at Nabble.com. >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscribe@... >>> For additional commands, e-mail: users-help@... >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscribe@... >> For additional commands, e-mail: users-help@... >> >> >> > > -- > View this message in context: http://www.nabble.com/%40SpringBean-vs-%40Configurable-tp18572291p18579719.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: @SpringBean vs @ConfigurableIs it right that also userspage is also not serializable because userservice
is not serializable (not a proxy)? Regards, Rik 2008/7/21 Igor Vaynberg <igor.vaynberg@...>: > class usersdataprovider implements dataprovider { > final userservice svc; > public int size() { return svc.size(); } > } > > @configurable class userspage extends webpage { > private userservce svc; > public userspage() { > add(new dataview("users", new dataprovider(svc))); > } > > this takes a reference of injected userservice svc and passes it to > the dataprovider. now dataprovider has a hard reference to the service > and is no longer serializable. > > if you use a @springbean generated proxy, this would still work fine. > > -igor > > On Mon, Jul 21, 2008 at 1:50 PM, Matt Welch <matthew@...> wrote: > > > > > > igor.vaynberg wrote: > >> > >> you have to be careful not to pass references to injected beans to > >> other objects. other than that i think you should be fine. > >> > > I know I should understand that, but my brain doesn't want to parse that > > sentence for some reason. > > > > references to injected beans - What does that mean? The domain object is > an > > injected bean (if it was annotated with @Configurable) and a reference to > it > > would presumably be passed to the Wicket component so that the that > > component could process it. Are you saying that this should be avoided? > > > > other objects - Can you maybe give an example of the "other objects" you > > have in mind? > > > > Matt > > > > -- > > View this message in context: > http://www.nabble.com/%40SpringBean-vs-%40Configurable-tp18572291p18577287.html > > Sent from the Wicket - User mailing list archive at Nabble.com. > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscribe@... > > For additional commands, e-mail: users-help@... > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > > |
|
|
Re: @SpringBean vs @Configurableno.
@configurable overides serialization and null sout the reference. @springbean injects a proxy that is serializable. -igor On Tue, Jul 22, 2008 at 12:05 AM, Rik van der Kleij <rik@...> wrote: > Is it right that also userspage is also not serializable because userservice > is not serializable (not a proxy)? > > Regards, > Rik > > 2008/7/21 Igor Vaynberg <igor.vaynberg@...>: > >> class usersdataprovider implements dataprovider { >> final userservice svc; >> public int size() { return svc.size(); } >> } >> >> @configurable class userspage extends webpage { >> private userservce svc; >> public userspage() { >> add(new dataview("users", new dataprovider(svc))); >> } >> >> this takes a reference of injected userservice svc and passes it to >> the dataprovider. now dataprovider has a hard reference to the service >> and is no longer serializable. >> >> if you use a @springbean generated proxy, this would still work fine. >> >> -igor >> >> On Mon, Jul 21, 2008 at 1:50 PM, Matt Welch <matthew@...> wrote: >> > >> > >> > igor.vaynberg wrote: >> >> >> >> you have to be careful not to pass references to injected beans to >> >> other objects. other than that i think you should be fine. >> >> >> > I know I should understand that, but my brain doesn't want to parse that >> > sentence for some reason. >> > >> > references to injected beans - What does that mean? The domain object is >> an >> > injected bean (if it was annotated with @Configurable) and a reference to >> it >> > would presumably be passed to the Wicket component so that the that >> > component could process it. Are you saying that this should be avoided? >> > >> > other objects - Can you maybe give an example of the "other objects" you >> > have in mind? >> > >> > Matt >> > >> > -- >> > View this message in context: >> http://www.nabble.com/%40SpringBean-vs-%40Configurable-tp18572291p18577287.html >> > Sent from the Wicket - User mailing list archive at Nabble.com. >> > >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: users-unsubscribe@... >> > For additional commands, e-mail: users-help@... >> > >> > >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscribe@... >> For additional commands, e-mail: users-help@... >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: @SpringBean vs @ConfigurableRik,
Also see http://jira.springframework.org/browse/SPR-4302 Regards - Cemal http://jWeekend.co.uk
|
| Free Forum Powered by Nabble | Forum Help |