public void run() {
    TestBean target = new TestBean();
    Pointcut pc = new ControlFlowPointcut(ControlFlowPointcutExample.class, "test"); //
    Advisor advisor = new DefaultPointcutAdvisor(pc, new SimpleBeforeAdvice());
    ProxyFactory pf = new ProxyFactory();
    pf.setTarget(target);
    pf.addAdvisor(advisor);
    TestBean proxy = (TestBean) pf.getProxy();
    System.out.println("Trying normal invoke");
    proxy.foo();

    System.out.println("Trying under ControlFlowExample.test()");
    // 只有从ControlFlowExample.test() 中调用的代理对象的方法,才被增强
    test(proxy);
  }
 private void test(TestBean bean) {
   bean.foo();
 }