indexing does not (yet) analyze beans in more detail when defined via @Bean
method
#1462
Labels
for: eclipse
something that is specific for Eclipse
for: vscode
something that is specific for VSCode
theme: events
theme: spring index & symbols
type: enhancement
Milestone
At the moment, the indexer creates matching
Bean
elements for beans that are defined via@Bean
annotated methods. However, more details that might belong to the bean definition are often not taken into account this way.One example is the indexing for
EventListener
beans:where the corresponding bean definition is included in a
@Configuration
class, e.g.:At runtime, this bean is notified of
ApplicationEvent
s. However, the indexer only takes this into account and creates correspondingEventListenerIndexElement
objects as children for the index element of the bean this event listener belongs to - in case the listener is defined as a@Component
itself. In that case,@EventListener
annotated methods as well ashandleEvent
methods via theApplicationListener
interface implementation are taken into account. In case the listener is defined using a@Bean
annotated method, this doesn't happen.The reason for this is that the event indexing happens for
@EventListener
annotations when there is a parent bean defined for the same source file (via the symbol provider for@EventListener
) or via the symbol provider for@Component
in case theApplicationListener
interface is implemented.The solution would be to index the type that is used for the
@Bean
method when indexing the@Bean
annotated method (so looking into the type of the bean itself), but that is not easy. The indexer can easily look into the referenced type, but can't easily create location objects for whatever it finds in there, since it looks at resolved type bindings, not source code anymore. We need to investigate this in more detail.The events example is probably only the tip of the iceberg.
The text was updated successfully, but these errors were encountered: