Package demo.proxy

Source Code of demo.proxy.ProxyDemo

package demo.proxy;

import org.springframework.aop.framework.ProxyFactory;

import core.Bank;
import core.StubBank;

public class ProxyDemo {

  public static void main(String[] args) {
    StubBank target = new StubBank();
    LoggingAdvice advice = new LoggingAdvice();
    ProxyFactory pf = new ProxyFactory(target);
    pf.addAdvice(advice);
    Bank bank = (Bank) pf.getProxy();
    bank.debit("abc", 100);
    bank.credit("abc", 200);
  }

}
TOP

Related Classes of demo.proxy.ProxyDemo

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.