2005/11/6, Alexandru Popescu <[EMAIL PROTECTED]>: > #: Eduardo Rocha changed the world a bit at a time by saying on 11/6/2005 > 3:51 PM :# > > I think Christian's idea is nice, and I saw at least three comments against > > it: > > > > 1. It is necessary to call injectDependencies on deserialization (Igor) > > > > If a component implements "protected Object readResolve() throws > > ObjectStreamException", as specified in Serializable class, I think > > this could be handled, what do you think? > > > > Yes - or at least this is what is supposed to be the correct way to handle it. > > > 2. The component itself would do lookups (Alexandru). > > > > Yes, but it would be a base class, and as a user you would never see > > as your component doing the lookup. Otherwise, as said in a previous > > thread, there could be a phase in the RequestCycle responsible for > > injecting things, and that would also solve the issue (1). > > > > The idea of the RequestCycle doing also injection is one that I like. > Unfortunately it will not be > able to solve the page/component injection. Wicket is encouragging the usage > of normal Java > constructors for adding pages, components, etc. For having automatic > injection on these I really > don't see any good solution other than aop ;-). >
It could be a setter injection. Personally I think that using a service in the constructor is not the way to go, I prefer to delay the use of a service when is really needed. So the calls to the service should be in one of onBeginXXX, when the RequestCycle should already have injected the service. > > ./alex > -- > .w( the_mindstorm )p. > > > 3. You should never ever call a overridable method in a constructor (Eelco). > > > > Make it final? > > > > 2005/10/27, Christian Essl <[EMAIL PROTECTED]>: > >> On Thu, 27 Oct 2005 16:15:37 -0700, Eelco Hillenius > >> <[EMAIL PROTECTED]> wrote: > >> > >> > Furthermore, you should never ever call a overridable method in a > >> > constructor. > >> > >> You are right. It must be commented to not be dependent on any state set > >> of the constructors below this magic helper class. Apart of this > >> overriding is generaly a bit dangerous if you don't read the comment well > >> and don't know when it is called. > >> > >> Anyway it was just an idea. I like this 'injection' thing just not AOP. > >> > >> Christian > >> > >> > > >> > Eelco > >> > > >> > On 10/27/05, Alexandru Popescu <[EMAIL PROTECTED]> > >> > wrote: > >> >> #: Christian Essl changed the world a bit at a time by saying on > >> >> 10/28/2005 12:54 AM :# > >> >> > Is AOP realy needed for that? > >> >> > > >> >> > Propably I do not understand the problem but why can't you just write > >> >> a > >> >> > special Panel, Page etc which calls an overrideable > >> >> injectDependencies() > >> >> > method in the constructor. The default implementation of > >> >> > injectDependencies() does basicly read the annotations, lookup the > >> >> > services and inject them? > >> >> > >> >> Because in this case the component itself does the lookup. And this is > >> >> not what you really want. > >> >> > >> >> ./alex > >> >> -- > >> >> .w( the_mindstorm )p. > >> >> > >> >> I think this way you could on an instance by > >> >> > instance basis fine-grain control what gets injected. And during > >> >> testing > >> >> > you just inject the mocks in this overriden method. > >> >> > > >> >> > Just my two cents. > >> >> > > >> >> > Thanks, > >> >> > Christian > >> >> > > >> >> > On Thu, 27 Oct 2005 21:50:02 +0200, Stefan Arentz > >> >> > <[EMAIL PROTECTED]> wrote: > >> >> > > >> >> >> > >> >> >> On Oct 27, 2005, at 9:21 PM, Sven Meier wrote: > >> >> >>> > >> >> >>> BTW rather than letting panels pull service from the page, I'd > >> >> prefer > >> >> >>> the page to push services into its panels (i.e. the page injects > >> >> >>> dependencies into its panels). > >> >> >>> I don't want my panels to be dependent on the containing page. > >> >> >> > >> >> >> Yup. That is exactly what I do. > >> >> >> > >> >> >> But. I just moved the aspect from WebPage to Component and guess > >> >> what, > >> >> >> the annotation and bean resolving works fine in Panels and > >> >> >> WebComponents too now :-) > >> >> >> > >> >> >> It is still to hackerish to use btw. There are some really nasty > >> >> delays > >> >> >> for example. I need to find some time to polish this. > >> >> >> > >> >> >> S. > >> >> >> > >> > >> > >> -- > >> Christian Essl > >> > >> > > > > ------------------------------------------------------- > SF.Net email is sponsored by: > Tame your development challenges with Apache's Geronimo App Server. Download > it for free - -and be entered to win a 42" plasma tv or your very own > Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php > _______________________________________________ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user