共有3个班级:
@Component
public class AsyncTestBean {
}
@Component
public class MyAsyncConfigurerSupport extends AsyncConfigurerSupport {
@Autowired
private AsyncTestBean test;
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return null;
}
}
@Service
public class InitializingService extends InstantiationAwareBeanPostProcessorAdapter {
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) {
if (bean instanceof AsyncTestBean) {
System.out.println("---");
}
}
}
运行它,我们将无法获得输出---
但是,如果我删除了@Autowired
中的MyAsyncConfigurerSupport
,那就可以了。
怎么了?