With AspectJ you can use good citizen as well. I saw the wiki and a
nice solution was found. With AspectJ is you can code naturally like
(if you do not use the service in constructor):

MyPage page = new MyPage();
page.setService(mockService);
tester.startPage(page);
tester.assertRenderedPage(MyPage.class);

instead of setting the context mock, which is a nice solution as well.

I use the Injector only on BookmarkablePages otherwise I inject by hand - a lot of real DI citicens. And for the BookmarkablePages I have two constructors one which calls the Injector the other one which does not. So I don't even have to set context mock. There is no difference to AspectJ.



I don't know if IoC means the container must manage the lifecycle, I
would go for something like "the environment is the responsible".
Using AspectJ you are setting the environment to do DI for you, so
inverting the control; the page (or its superclass) is not looking for
the dependency, an outside code it is.

Please see the arictel of Fowlers (http://www.martinfowler.com/articles/injection.html). According to this articel I'd say both AspectJ and the Injector use more the ServiceLocator pattern than DI. The ServiceLocator is the SpringContext. Something Spring is very proud of is that no bean is dependent on the ApplicationContext (because of DI). However this is not true for either the AspectJ approach nor the current Injector approach, because you'll always need a ApplicationContext to look up the bean to inject.

I think for Wicket the current lookup aproach is very good (for various reasons already discussed) and I realy do not see an advantage of AspectJ.

Beside this (the new) AspectJ has an issue with (old) CGLIB (see the CGLIB users list) and this is extensively used in a lot of projects (like Hibernate, Spring etc).

Christian
        

        
                
___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to