Consider the following example:

@Async
public void runTask() { ... }

When @Async is meta-annotated with @Reflective, runTask has a method invocation hint so that it can be both discovered and invoked at runtime. However, this behavior works by finding methods that are annotated with @Async. @Async itself isn't added at the moment and that leads to quite a lot of boilerplate.

It would be nice if the processor was able to handle this use case automatically. Also, it is a BeanRegistrationAotProcessor at the moment, and it would benefit from being a BeanFactoryAotProcessor so that we have the ability to run something "once" rather than per bean.

The current invocation is as simple as:

for (String beanName : beanFactory.getBeanDefinitionNames()) {
    RegisteredBean registeredBean = RegisteredBean.of(beanFactory, beanName);
    // invoke BeanRegistrationAotProcessor
}

Comment From: snicoll

It looks like this is already working as expected.

Comment From: snicoll

This issue has been superseded by #28967