I have seen a lot of discussion on how properly write unit test code
with these proxies, does a neat solution was found? Using AspectJ
makes natural setting mocks, since it checks to see whether the field
is null. Also, it is a true IoC solution, and besides proxing does DI,
it isn't a "pure" solution.
2005/12/14, Christian Essl <[EMAIL PROTECTED]>:
> Me too. I see no reason in using AspectJ. Just use interfaces (which is
> nearly always good design) and everything works fine. And in face of DAOs
> the performance problem of the reflective method call is not realy there.
>
> Christian
>
> On Wed, 14 Dec 2005 08:00:37 -0800, Igor Vaynberg
> <[EMAIL PROTECTED]> wrote:
>
> > aspectj sounds pretty sweet. i guess it would work in majority of cases.
> > the
> > reason i would still prefer proxies is because I like constructs like
> > this:
> >
> > MyDataProvider implements IDataProvider {
> > private MyService svc;
> >
> > MyDataProvider(MyService svc) {
> > this.svc=svc;
> > }
> > ...
> > }
> >
> > this allows me to use the same dataprovider on a subset of services that
> > all
> > extend the same subinterface. and i think in general its more clear when
> > you
> > write code like
> > MyDataProvider provider=new MyDataProvider(service);
> >
> > but this is just a personal preference.
> >
> > -Igor
> >
> >
> >
> > On 12/14/05, Christian Essl <[EMAIL PROTECTED]> wrote:
> >>
> >> Right. Thanks for the advice :)
> >>
> >> BTW If you do not use interfaces, you can also not advice final methods
> >> or
> >> methods on a final class.
> >>
> >> The concern here is that when you do not use an interface proxy this
> >> also
> >> applies to the proxies which we use in spring-integration. This is a
> >> limitation of cglib, which is used by both Spring-AOP and
> >> Spring-integration proxies, when the proxy-type needed is not (an)
> >> interface(s).
> >>
> >> Christian
> >>
> >> On Wed, 14 Dec 2005 14:01:35 +0100, Laurent PETIT
> >> <[EMAIL PROTECTED]> wrote:
> >>
> >> > On 12/14/05, Christian Essl <[EMAIL PROTECTED]> wrote:
> >> >> AspectJ modfies the byte-code of your class while Spring-AOP either
> >> >> creates a proxy or a subclass. This means that ie in Spring-AOP you
> >> can
> >> >> not advice field acess or statements within a method. Basicly with
> >> >> spring
> >> >> AOP you can only adivce calls to a certain method.
> >> >
> >> > Hello, it's not totally right to say "spring AOP you can only adivce
> >> > calls to a certain method". Reality is a bit worse:
> >> >
> >> > With spring AOP, you can only advice method calls when the calls
> >> > originate from an instance that is not the instance that holds the
> >> > method.
> >> > So : if the method AClass.method1 is adviced with springAOP, and if in
> >> > a method AClass.method2 you do something like this.method1() then you
> >> > don't use the proxied instance and springAOP will not work.
> >> >
> >> > So with spring AOP, you can't advice private methods, and you can
> >> > advice (default), protected and public methods as long as you do not
> >> > call them directly from other methods of the same instance.
> >> >
> >> >
> >> > My 0.02 EUR,
> >> >
> >> > --
> >> > Laurent
> >> >
> >> >
> >> > -------------------------------------------------------
> >> > 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_idv37&alloc_id865&op=click
> >> > _______________________________________________
> >> > Wicket-user mailing list
> >> > [email protected]
> >> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>
> >>
> >>
> >> --
> >> Christian Essl
> >>
> >>
> >>
> >>
> >>
> >> ___________________________________________________________
> >> 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
> >> [email protected]
> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>
>
>
>
> --
> Christian Essl
>
>
>
>
>
> ___________________________________________________________
> 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
-------------------------------------------------------
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_idv37&alloc_id865&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user