spring笔记

来源:互联网 发布:凯聪智云软件 编辑:程序博客网 时间:2024/06/01 07:18

1 spring MethodReplacer 的reimplement是用来替换的,不能通过反射调用方法,否则会陷入死循环

public class CellWrapper implements MethodReplacer{public Object reimplement(Object obj, Method method, Object[] args) throws Throwable {System.out.println("替换前");method.invoke(obj, args);//错误System.out.println("after replace");return null;}}


2.spring 事件核心代码

public void multicastEvent(final ApplicationEvent event) {for (final ApplicationListener listener : getApplicationListeners(event)) {Executor executor = getTaskExecutor();if (executor != null) {executor.execute(new Runnable() {public void run() {listener.onApplicationEvent(event);}});}else {listener.onApplicationEvent(event);}}}