为什么需要AOP?
需求加减乘除
package com.tanlei.spring.bean.Aop; public interface AtithmeticCalculator { int add(int i,int j); int sub(int i,int j); int mul(int i,int j); int div(int i,int j); }
package com.tanlei.spring.bean.Aop; public class AtithmeticCalculatorImpl implements AtithmeticCalculator{ @Override public int add(int i, int j) { System.out.println("the method add begin whith ["+i+","+j+"]"); int result=i+j; System.out.println("the method add end whith"+result); return result; } @Override public int sub(int i, int j) { System.out.println("the method sub begin whith ["+i+","+j+"]"); int result=i-j; System.out.println("the method sub end whith"+result); return result; } @Override public int mul(int i, int j) { System.out.println("the method mul begin whith ["+i+","+j+"]"); int result=i*j; System.out.println("the method mul end whith"+result); return result; } @Override public int div(int i, int j) { System.out.println("the method div begin whith ["+i+","+j+"]"); int result=i/j; System.out.println("the method div end whith"+result); return result; } }