This happens a lot in IntelliJ with Spring Data beans. IntelliJ does not parse examples from Spring data namespace configurations too well. As an example (in addition to yours), IntelliJ will not correctly validate the @Autowired or @Inject ed class, which extends Spring Data MongoRepository . As you noticed, this will not harm your application, but during development it is very annoying. Here is how you can suppress the "error":
@SuppressWarnings("SpringJavaAutowiringInspection") @Autowired Neo4jTemplate template;
You can do the same by clicking the red light (error indicator when you hover over an item with a red underline), selecting Autowiring Verify Class Bean for Bean, and then finally Suppress Field. Or, if you want to suppress it for your class, select Suppress For Class.
Mattenter
source share