Skip to content

Instantly share code, notes, and snippets.

@mehmetcemyucel
Created March 27, 2021 09:52
Show Gist options
  • Select an option

  • Save mehmetcemyucel/bf5e02c78570d6d1a3baa670f62be33d to your computer and use it in GitHub Desktop.

Select an option

Save mehmetcemyucel/bf5e02c78570d6d1a3baa670f62be33d to your computer and use it in GitHub Desktop.
spring-native-proxy
public class Main {
public static void main(String[] args) {
ProxyFactory factory = new ProxyFactory(new SimplePojo());
factory.addInterface(Pojo.class);
factory.addAdvice(new RetryAdvice());
Pojo pojo = (Pojo) factory.getProxy();
pojo.foo();
}
}
public class SimplePojo implements Pojo {
public void foo() {
((Pojo) AopContext.currentProxy()).bar();
}
public void bar() {
// some logic...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment