jdk8新特性:在用Repository实体查询是总是提示要java.util.Optional

在使用springboot 方法报错:

Inferred type 'S' for type parameter 'S' is not within its bound; should extends xxxxxx

 

解决方法:

1、springboot 版本问题,将 2.0.1 版本换成 1.5.4 版本。

2、将girlRepository.findOne(id); 改为 girlRepository.findById(id).orElse(null); 或

girlRepository.findById(id).get();

相关文章:

  • 2021-08-19
  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-21
  • 2021-12-26
  • 2021-09-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-25
  • 2021-07-06
  • 2021-04-27
相关资源
相似解决方案