intellij incorrectly saying no beans of type found for autowired repository
If IntelliJ is saying "No beans of type 'X' found for autowiring" for a repository that you are trying to autowire, it means that the Spring application context does not contain a bean of the specified type. This can happen for a few reasons:
The repository is not being scanned by the Spring application context: Make sure that the repository is being scanned by the Spring application context. You can do this by annotating the repository class with
@Repository
and making sure that it is in a package that is being scanned by the application context.The repository is not being created as a bean: Make sure that the repository is being created as a bean by the Spring application context. You can do this by annotating the repository class with
@Repository
and making sure that it is in a package that is being scanned by the application context.There is a typo in the repository class name: Make sure that you have spelled the repository class name correctly in the
@Autowired
annotation.The repository class is not being imported correctly: Make sure that the repository class is being imported correctly in the class where it is being autowired.
The repository class is in a different application context: If you are using multiple application contexts in your application, make sure that the repository class is in the same application context as the class where it is being autowired.
If none of these solutions solve the problem, there may be other issues causing the problem. You may want to check the logs to see if there are any other error messages that can help you troubleshoot the issue.