Java Code Examples for org.springframework.scheduling.annotation.AsyncConfigurer

The following are top voted examples for showing how to use org.springframework.scheduling.annotation.AsyncConfigurer. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: java-spring-cloud   File: CustomAsyncConfigurerAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
  if (bean instanceof AsyncConfigurer) {
    AsyncConfigurer configurer = (AsyncConfigurer) bean;
    return new TracedAsyncConfigurer(tracer, configurer);
  }
  return bean;
}
 
Example 2
Project: java-spring-cloud   File: CustomAsyncConfigurerAutoConfigurationTest.java   Source Code and License 5 votes vote down vote up
@Test
public void should_return_async_configurer_when_bean_instance_of_it() {
  CustomAsyncConfigurerAutoConfiguration configuration = new CustomAsyncConfigurerAutoConfiguration();
  Object bean = configuration
      .postProcessAfterInitialization(mock(AsyncConfigurer.class), "myAsync");
  then(bean).isInstanceOf(TracedAsyncConfigurer.class);
}
 
Example 3
Project: Zipkin   File: AsyncCustomAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Override
public Object postProcessAfterInitialization(Object bean, String beanName)
		throws BeansException {
	if (bean instanceof AsyncConfigurer) {
		AsyncConfigurer configurer = (AsyncConfigurer) bean;
		return new LazyTraceAsyncCustomizer(this.beanFactory, configurer);
	}
	return bean;
}
 
Example 4
Project: Zipkin   File: AsyncCustomAutoConfigurationTest.java   Source Code and License 5 votes vote down vote up
@Test
public void should_return_lazy_async_configurer_when_bean_is_async_configurer() throws Exception {
	AsyncCustomAutoConfiguration configuration = new AsyncCustomAutoConfiguration();

	Object bean = configuration
			.postProcessAfterInitialization(mock(AsyncConfigurer.class), "someName");

	then(bean).isInstanceOf(LazyTraceAsyncCustomizer.class);
}
 
Example 5
Project: spring-cloud-sleuth   File: AsyncCustomAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Override
public Object postProcessAfterInitialization(Object bean, String beanName)
		throws BeansException {
	if (bean instanceof AsyncConfigurer) {
		AsyncConfigurer configurer = (AsyncConfigurer) bean;
		return new LazyTraceAsyncCustomizer(this.beanFactory, configurer);
	}
	return bean;
}
 
Example 6
Project: spring-cloud-sleuth   File: AsyncCustomAutoConfigurationTest.java   Source Code and License 5 votes vote down vote up
@Test
public void should_return_lazy_async_configurer_when_bean_is_async_configurer() throws Exception {
	AsyncCustomAutoConfiguration configuration = new AsyncCustomAutoConfiguration();

	Object bean = configuration
			.postProcessAfterInitialization(mock(AsyncConfigurer.class), "someName");

	then(bean).isInstanceOf(LazyTraceAsyncCustomizer.class);
}
 
Example 7
Project: java-spring-cloud   File: TracedAsyncConfigurer.java   Source Code and License 4 votes vote down vote up
public TracedAsyncConfigurer(Tracer tracer, AsyncConfigurer delegate) {
  this.tracer = tracer;
  this.delegate = delegate;
}
 
Example 8
Project: Zipkin   File: LazyTraceAsyncCustomizer.java   Source Code and License 4 votes vote down vote up
public LazyTraceAsyncCustomizer(BeanFactory beanFactory, AsyncConfigurer delegate) {
	this.beanFactory = beanFactory;
	this.delegate = delegate;
}
 
Example 9
Project: spring-cloud-sleuth   File: LazyTraceAsyncCustomizer.java   Source Code and License 4 votes vote down vote up
public LazyTraceAsyncCustomizer(BeanFactory beanFactory, AsyncConfigurer delegate) {
	this.beanFactory = beanFactory;
	this.delegate = delegate;
}