<!-- Spring Event 异步调用 -->
<bean id="simpleApplicationEventMulticaster" class="org.springframework.context.event.SimpleApplicationEventMulticaster">
<property name="taskExecutor"><ref local="asyncTaskExecutor"/></property>
</bean>
<bean id="asyncTaskExecutor" class="org.springframework.core.task.SimpleAsyncTaskExecutor"/>
测试方法
System.out.println("=================" + System.currentTimeMillis());
Thread.sleep(100);
logStatService.statAccessLog(message.toString());
System.out.println("222222222222222222222222" + System.currentTimeMillis());
111111111111377853354127
controller的时间
11111111111222222221377853354161
=================1377853354166
event中的时间
2222222222222222222222221377853354267
<bean id="simpleApplicationEventMulticaster" class="org.springframework.context.event.SimpleApplicationEventMulticaster">
<property name="taskExecutor"><ref local="asyncTaskExecutor"/></property>
</bean>
<bean id="asyncTaskExecutor" class="org.springframework.core.task.SimpleAsyncTaskExecutor"/>
测试方法
System.out.println("=================" + System.currentTimeMillis());
Thread.sleep(100);
logStatService.statAccessLog(message.toString());
System.out.println("222222222222222222222222" + System.currentTimeMillis());
111111111111377853354127
controller的时间
11111111111222222221377853354161
=================1377853354166
event中的时间
2222222222222222222222221377853354267