The type java.util.Optional cannot be resolved. it is indirectly referenced from required is the compilation issue.
我用java8开发了一个应用程序,但在我的jumphost服务器上,java7是最新的。我不能将jumphost升级到8,所以不得不将我的项目降级以在java7中编译。现在我的接口抛出了这个编译时问题。
这是一个基本的spring-boot + maven +mongodb项目。我正在使用MongoRepository连接到数据库。抛出这个问题的接口是:
public interface AlertsFiredMongoRepository extends MongoRepository<AlertsFired, ObjectId>
我的spring-boot代码的配置类application.java有mongoClient。我没有任何其他的mongo db配置。
@Bean
public MongoClient mongoClient()
{
//connecting to just primary db is also fine.
return new MongoClient(new MongoClientURI("mongoURI"));
}
它应该是编译好的,并且工作正常。
发布于 2019-05-03 19:34:38
Spring Boot 1.4.1.RELEASE是使用Java7的最新版本。
以后的每个版本都需要至少Java 8。
https://stackoverflow.com/questions/55968815
复制相似问题