IntelliJ IDEA is showing errors when I use Spring's @Autowired annotation in the class, but the class is functioning without any problem.
Here is this error message:
Autowired members must be defined in the valid spring bean (@Component/@Service,etc.) less... (Ctrl+F1) Checks autowiring problems in a bean class.







Make sure you have your Spring bean definitions correct. Sometimes, the application works fine, it just displays an error in the IDE, check your project ‘iml’ file if you have a Spring facet defined.