IntelliJ IDEA shows errors when using Spring's @Autowired annotation
Solution 1:
I had the same problem with IntelliJ IDEA 13.1.4 I solved it by removing the Spring facet (File->Project Structure) and leaving it to just show "Detection".
Solution 2:
I fixed it by adding the supress warning:
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Autowired
private ....
Solution 3:
If you know that the bean exists and its just a problem of the inspections, then just add the following before the variable declaration:
@SuppressWarnings("SpringJavaAutowiringInspection")
@Inject MyClass myVariable;
Sometimes IntelliJ cannot resolve if a bean has been declared, for example when the bean is included conditionally and the condition resolution happens dynamically at runtime. In such a case it seems the static code analyzer of IntelliJ cannot detect the bean.
Solution 4:
Got the same error here!
It seems the Intellij cannot verify if the class implementation is a @Service or @Component.
Solve it just changing from Error to Warning(Pressing Alt + Enter).
Solution 5:
Remove .iml file from all your project module and next go to File -> Invalidate Caches/Restart