How to Prevent 'Could Not Autowire' Errors for Dynamically Registered Beans in IntelliJ?

Answered

I am trying to use a custom marker annotation to dynamically register beans, similar to @FeignClient, without using @Bean or @Component. Instead of registering individual classes one by one, I load all classes dynamically through a class loader, regardless of their type.

After the bean injection is completed, I encounter the message:
"Could not autowire. No beans of 'XXXClient' type found."

How can I prevent this message from appearing? Do you have any guidelines or best practices for solving this issue?

In a similar case with @FeignClient, it seems that IntelliJ provided support, as seen in the link below. I’m wondering if explicit support from IntelliJ is necessary for this to work, or if it can function without such support.
(https://youtrack.jetbrains.com/issue/IDEA-168155/Spring-support-meta-annotations-w-EnableFeignClients)

0
1 comment
Please elaborate on your question. Is this error message displayed in the IDEA code editor window? Please provide a minimal sample project so I can reproduce the issue without including your sensitive code. Thank you!

Please upload it to  https://uploads.jetbrains.com/ and paste the upload id here, the uploaded file is only visible to JetBrains employees.
0

Please sign in to leave a comment.