Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save gokepler/e9d3beadbf439bf005b7a8c5eb2da759 to your computer and use it in GitHub Desktop.

Select an option

Save gokepler/e9d3beadbf439bf005b7a8c5eb2da759 to your computer and use it in GitHub Desktop.
Creating Spring AspectJ Proxy programmatically
XuxuService service = new XuxuServiceImpl();
RetryAndNotifyOnErrorAspect myaspect = new RetryAndNotifyOnErrorAspect();
AspectJProxyFactory factory = new AspectJProxyFactory(service);
factory.addAspect(myaspect);
// factory.setProxyTargetClass(true); // if you're applying to a concrete class
XuxuService proxy = factory.getProxy();
// just run it
proxy.execute();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment