[英]IntelliJ IDEA not supporting Lambda?
I'm working with this tutorial which uses lambda expressions. 我正在使用使用lambda表达式的本教程。
Spring Boot - Bookmarks Spring Boot-书签
But IntelliJ says always: cannot resolve method(<lambda expression>)
. 但是IntelliJ总是说:
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.". 您需要将“项目语言级别”更改为“ 8-Lambda,输入注释等”。 You can find this option in "Project Settings" -> "Project"
您可以在“项目设置”->“项目”中找到此选项
It looks like your IntelliJ or your project is not setup to use Java 8. 看来您的IntelliJ或您的项目未设置为使用Java 8。
It should look something like this: 它看起来应该像这样:
In addition to the answers above look into you pom.xml file. 除了上述答案之外,您还可以查看pom.xml文件。 Source and target should be 1.8 or higher.
源和目标应为1.8或更高。 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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.