title: How to configure Async and Sync Event publishers using spring
body: <p>I am trying to implement an event framework using spring events.I came to know that the default behavior of spring event framework is sync. But during spring context initialization if it finds a bean with id applicationEventMulticaster it behaves Async.</p>
  
  <p>Now i want to have both sync and async event publishers in my application, because some of the events needs to be published sync. I tried to configure sync event multicaster using SysncTaskExecutor, but i cant find a way to inject it into my AsyncEventPublisher's applicationEventPublisher property.
  My spring configuration file is as below</p>
  
  <pre><code>&lt;bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor" destroy-method="shutdown"&gt;
          &lt;property name="corePoolSize" value="5" /&gt;
          &lt;property name="maxPoolSize" value="10" /&gt;
          &lt;property name="WaitForTasksToCompleteOnShutdown" value="true" /&gt;
      &lt;/bean&gt;  
  
      &lt;bean id="syncTaskExecutor" class="org.springframework.core.task.SyncTaskExecutor" /&gt;
  
      &lt;bean id="customEventPublisher" class="x.spring.event.CustomEventPublisher" /&gt;
      &lt;bean id="customEventHandler" class="x.spring.event.CustomEventHandler" /&gt;  
      &lt;bean id="eventSource" class="x.spring.event.EventSource" /&gt; 
      &lt;bean id="responseHandler" class="x.spring.event.ResponseHandler" /&gt; 
      &lt;bean id="syncEventSource" class="x.spring.event.syncEventSource" /&gt; 
  
  
      &lt;bean id="applicationEventMulticaster" class="org.springframework.context.event.SimpleApplicationEventMulticaster"&gt;
          &lt;property name="taskExecutor" ref="taskExecutor" /&gt;         
      &lt;/bean&gt;    
  
      &lt;bean id="syncApplicationEventMulticaster" class="org.springframework.context.event.SimpleApplicationEventMulticaster"&gt;
          &lt;property name="taskExecutor" ref="syncTaskExecutor" /&gt;         
      &lt;/bean&gt;    
  </code></pre>
  
  <p>Can anyone help me out here ?</p>