use of org.springframework.context.event.SimpleApplicationEventMulticaster in project tutorials by eugenp.
the class AsynchronousSpringEventsConfig method simpleApplicationEventMulticaster.
@Bean(name = "applicationEventMulticaster")
public ApplicationEventMulticaster simpleApplicationEventMulticaster() {
final SimpleApplicationEventMulticaster simpleApplicationEventMulticaster = new SimpleApplicationEventMulticaster();
simpleApplicationEventMulticaster.setTaskExecutor(new SimpleAsyncTaskExecutor());
return simpleApplicationEventMulticaster;
}
use of org.springframework.context.event.SimpleApplicationEventMulticaster in project yaps-client by serdaroquai.
the class ApplicationConfig method simpleApplicationEventMulticaster.
// spring asynchronous event handling
@Bean(name = "applicationEventMulticaster")
public ApplicationEventMulticaster simpleApplicationEventMulticaster(Executor executor) {
SimpleApplicationEventMulticaster eventMulticaster = new SimpleApplicationEventMulticaster();
eventMulticaster.setTaskExecutor(executor);
return eventMulticaster;
}
use of org.springframework.context.event.SimpleApplicationEventMulticaster in project data-prep by Talend.
the class AsynchronousSpringEventConfiguration method simpleApplicationEventMulticaster.
@Bean(name = "applicationEventMulticaster")
public ApplicationEventMulticaster simpleApplicationEventMulticaster() {
SimpleApplicationEventMulticaster eventMulticaster = new SimpleApplicationEventMulticaster();
eventMulticaster.setTaskExecutor(new SimpleAsyncTaskExecutor());
return eventMulticaster;
}
use of org.springframework.context.event.SimpleApplicationEventMulticaster in project spring-integration by spring-projects.
the class MessageBusParserTests method testAsyncMulticasterExplicitlySetToFalse.
@Test
public void testAsyncMulticasterExplicitlySetToFalse() throws Exception {
AbstractApplicationContext context = new ClassPathXmlApplicationContext("messageBusWithoutAsyncEventMulticaster.xml", this.getClass());
context.refresh();
SimpleApplicationEventMulticaster multicaster = (SimpleApplicationEventMulticaster) context.getBean(AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME);
DirectFieldAccessor accessor = new DirectFieldAccessor(multicaster);
Object taskExecutor = accessor.getPropertyValue("taskExecutor");
if (SpringVersion.getVersion().startsWith("2")) {
assertThat(taskExecutor.getClass()).isEqualTo(SyncTaskExecutor.class);
} else {
assertThat(taskExecutor).isNull();
}
context.close();
}
use of org.springframework.context.event.SimpleApplicationEventMulticaster in project spring-integration by spring-projects.
the class MessageBusParserTests method testAsyncMulticaster.
@Test
public void testAsyncMulticaster() throws Exception {
AbstractApplicationContext context = new ClassPathXmlApplicationContext("messageBusWithAsyncEventMulticaster.xml", this.getClass());
context.refresh();
SimpleApplicationEventMulticaster multicaster = (SimpleApplicationEventMulticaster) context.getBean(AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME);
DirectFieldAccessor accessor = new DirectFieldAccessor(multicaster);
Object taskExecutor = accessor.getPropertyValue("taskExecutor");
assertThat(taskExecutor.getClass()).isEqualTo(ThreadPoolTaskExecutor.class);
context.close();
}
Aggregations