I'm working with this tutorial which uses lambda expressions.
But IntelliJ says always: cannot resolve method(<lambda expression>)
.
What do I have to check?
this.accountRepository.findByUsername(userId).orElseThrow(() -> new UserNotFoundException(userId));
You need to change the "Project language level" to "8 - Lambdas, type annotations etc.". You can find this option in "Project Settings" -> "Project"
In addition to the answers above look into you pom.xml file. Source and target should be 1.8 or higher. eg
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.