Solution of spring auto injection always report error in IntelliJ idea In this case, change Error to Warning: