2005/11/6, Eelco Hillenius <[EMAIL PROTECTED]>:
> I see absolutely nothing wrong with lookups at that level. It's less
> code than you would need for any component configuration and it's more
> efficient too. And there are just no disadvantages, are there?
>
The Application class have references to all of the beans needed,
while it never uses them. With a big application, there could be
several of beans there, and get pretty messy. One could use instead
many ServiceLocators (not being the Application class), grouping
similar beans together to aliviate this problem (of course if it is
ever considered a problem :)).
And at the end of the day, the page is always referencing a class for
lookup. I don't think it is a problem, and has the advantage of lazy
loading, as Igor frequently talks about, but IoC is simply better,
more elegant. If you can use it, there is no reason for a lookup, the
code gets simpler. When you are testing a page, you set the dependency
in the page, you do not need to set the dependency in the locator.
> And... for this whole discussion: if you like one approach... go
> implement it now! Create your own component factory, annotations
> processor, aop, and please contribute when you've got something nice
> working. Or let us know when you need specific changes to Wicket to
> support your needs. We'll most probably honor such requests if they
> are reasonable as we've done in the past.
>
> Eelco
>
>
> On 11/6/05, Alexandru Popescu <[EMAIL PROTECTED]> wrote:
> > #: Igor Vaynberg changed the world a bit at a time by saying on 11/6/2005
> > 7:06 PM :#
> > > Or how about a simple solution:
> > >
> > > public MyApplication extends WebApplication {
> > > public Object lookup(String name) {
> > > Object=...do a lookup from somewhere like spring context or app object...;
> > > return object;
> > > }
> > > }
> > >
> > > public MyPage extends Page {
> > > public transient SomeService service;
> > >
> > > public SomeService getService() {
> > > if (service==null) {
> > > service=getApplication().lookup(SomeService.class.getName());
> > > }
> > > return service;
> > > }
> > >
> > > I know its not quiete as elegant as ioc but it has none of the performance
> > > hits an automatic injection would cause if it would be done on
> > > deserialization of every component. Also its a lazy lookup so you dont do
> > > it
> > > until its needed, and its only done once per page (until it gets
> > > deserialized).
> > >
> > > -Igor
> > >
> >
> > But this was exactly what I was suggesting to avoid ;-). Lookups and
> > factories are not ioc/di.
> >
> > ./alex
> > --
> > .w( the_mindstorm )p.
> >
> >
> >
> > -------------------------------------------------------
> > 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
> > [email protected]
> > 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
> [email protected]
> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user