public interface IMessageWriter {public void writeMessage(); } ///////////////////////////////////////////////////////////////////////////////////////public class MessageWriter implements IMessageWriter{public void writeMessage() { System.out.print("World"); } } ///////////////////////////////////////////////////////////////////////////////////////import java.lang.reflect.Method;import org.springframework.aop.MethodBeforeAdvice;import org.springframework.aop.framework.ProxyFactory;public class SimpleBeforeAdvice implements MethodBeforeAdvice {public static void main(String[] args) { MessageWriter target = new MessageWriter(); // create the proxy ProxyFactory pf = new ProxyFactory(); pf.addAdvice(new SimpleBeforeAdvice()); pf.setTarget(target); MessageWriter proxy = (MessageWriter) pf.getProxy(); // write the messages proxy.writeMessage(); }public void before(Method method, Object[] args, Object target)throws Throwable { System.out.println("Before method: " + method.getName()); } }