Skip to main content

Porting the Cuckoo's Egg

Posted by crazybob on October 21, 2004 at 9:56 AM PDT

Russell Miles continues his introduction to AOP in Spring with a Cuckoo's Egg Design Pattern example. The CuckoosEgg interceptor routes method invocations to alternative implementations in his ReplacementFeature class. The example Spring AOP configuration takes nearly 60 lines of XML to say, "apply the CuckoosEgg interceptor to and" Since Russell used the AOP Alliance API, we can reuse his same code with Dynaop and enjoy a considerably simpler BeanShell-based configuration:

  interceptor(IBusinessLogic, "foo", CuckoosEgg);
  interceptor(IBusinessLogic2, "bar", CuckoosEgg);

And, Dynaop integrates well with the rest of Spring.